We will take a small example below to see how jQuery separates behavioral characteristics from HTML structure.
In conventional programming for assigning click event for button we use the following code.
<input id="Button1" type="button" value="button" onclick="Test1()" />
alert("Hi, Button1 clicked me ");
In above code, on click of button1 Test1 function will be called.
But with the help of jQuery we can assign the click function for Button1 in runtime as shown below.
alert("JQuery Clicked me")
'$' is used as an 'alias' for the 'jQuery' namespace.
This keyword matches a single element present in the document with the given id attribute. If the id contains characters like periods or colons, we need to escape those using backslashes.
The latest stable versions of jQuery can also be downloaded from http://docs.jquery.com/Downloading_jQuery
Jquery contains the main following features
- Effects and animations
- CSS manipulation
- DOM traversal and modification
- Utilities - such as browser version and the each function
We will discuss these features one by one in details in next articles.