Monday, March 25, 2013

How to Include the jQuery Library Code in an HTML Page

jQuery online training Include jQuery Library Code in an HTML Page  Include  jQuery Library Code in an HTML Page

jQuery is a fast, small, and feature-rich JavaScript library. It makes things like HTML document traversal and manipulation, event handling, animation, and Ajax much simpler with an easy-to-use API that works across a multitude of browsers. With a combination of versatility and extensibility, jQuery has changed the way that millions of people write JavaScript.


There are currently two ideal solutions for embedding the jQuery library in a web page:

Use the Google-hosted content delivery network (CDN) to include a version of
jQuery (used in this chapter).
• Download your own version of jQuery from jQuery.com and host it on your own
server or local filesystem.

the following is a template that includes the jQuery library that you can use to start any jQuery project:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script type="text/JavaScript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
</head>
<body>
<script type="text/JavaScript">
alert('jQuery ' + jQuery.fn.jquery);
</script>
</body>
</html>

However, debugging JavaScript errors in minified code is not ideal. During code development, or on the production site, it actually ight be better to use the nonminified version from Google for the purpose of debugging potential JavaScript errors. For more information about using the Googlehosted version of jQuery, you can visit the Ajax libraries API site on the Web at http://

0 comments:

Post a Comment