Sunday, April 26, 2009

jQuery HowTo's |How to get started

 e-Book (Learning jQuery 1.3 Paperback)

Starting with jQuery needs three basic steps:

  1. First, download jQuery and store it in a location your web page can access. Download the latest version here.
  2. Include jQuery into your HTML page.
  3. Make use of jQuery's functionality.

A sample web page might look something like this:

<html>
<
head>
<
title>My first jQuery</title>

<
script type="text/javascript" src="path/to/jquery.1.2.1.pack.js"></script>

<
script type="text/javascript">
//this is jQuery code
$(document).ready(function () {
alert("I came from jQuery!");
});
</script>

</
head>
<
body>
<
h2>
jQuery sample</h2>
</
body>
</
html>


 



The jQuery code you decide to use depends on your needs. The rest of the How-To's on this page help to highlight what can be done. These are more simplistic examples though. Please visit the jQuery documentation or the jQuery mailing list for more details. The more advanced things you see jQuery do are usually a combination of the basics though.



A note about the different jQuery files.

jQuery tries to accomodate all types of developers. Those who want to get their hands dirty and explore jQuery's inner workings should download the uncompressed version of the jQuery library. All others probably want to use the packed version as this has the smallest footprint that is supported by all browsers. The packed version removes all extra spaces and comments to compress the library, and then encodes it to make it even smaller. The minified version of the library does the same, except it does not encode it.

No comments: