23-04-2012, 03:32 PM
Lecture of jQuery
J QUERY PPT.pptx (Size: 86.25 KB / Downloads: 75)
What is jQuery?
1) jQuery is a library of JavaScript Functions.
2) jQuery is a lightweight "write less, do more" JavaScript library.
3) The jQuery library contains the following features:
HTML element selections
HTML element manipulation
CSS manipulation
HTML event functions
JavaScript Effects and animations
HTML DOM traversal and modification
AJAX Utilities
Adding the jQuery Library to Your Pages
The jQuery library is stored as a single JavaScript file, containing all the jQuery methods.
It can be added to a web page with the following mark-up:
jQuery Syntax
The jQuery syntax is tailor made for selecting HTML elements and perform some action on the element(s).
Basic syntax is: $(selector).action()
A dollar sign to define jQuery
A (selector) to "query (or find)" HTML elements
A jQuery action() to be performed on the element(s)
jQuery Callback Functions
JavaScript statements are executed line by line. However, with animations, the next line of code can be run even though the animation is not finished. This can create errors.
To prevent this, you can create a callback function.
A callback function is executed after the current animation (effect) is finished.
jQuery Callback Example
Typical syntax: $(selector).hide(speed,callback)
The callback parameter is a function to be executed after the hide effect is completed: