JQUERY
WHAT IS JQUERY?
•jQuery is a lightweight, "write less, do more", JavaScript library.
•The purpose of jQuery is to make it much easier to use JavaScript on your website.
•jQuery takes a lot of common tasks that require many lines of JavaScript code to
accomplish, and wraps them into methods that you can call with a single line of
code.
•jQuery also simplifies a lot of the complicated things from JavaScript, like AJAX
calls and DOM manipulation.
The jQuery library contains the following features:
•HTML/DOM manipulation
•CSS manipulation
•HTML event methods
•Effects and animations
WHY JQUERY?
There are lots of other JavaScript libraries out there, but jQuery is
probably the most popular, and also the most extendable.
Many of the biggest companies on the Web use jQuery, such as:
•Google
•Microsoft
•IBM
•Netflix
ADDING JQUERY TO YOUR
WEB PAGES
JQUERY SYNTAX
The jQuery syntax is tailor-made for selecting HTML elements and
performing some action on the element(s).
Basic syntax is: $(selector).action()
•A $ sign to define/access jQuery
•A (selector) to "query (or find)" HTML elements
•A jQuery action() to be performed on the element(s)
Examples:
$(this).hide() - hides the current element.
$("p").hide() - hides all <p> elements.
$(".test").hide() - hides all elements with class="test".
$("#test").hide() - hides the element with id="test".
THE DOCUMENT READY
EVENT
JQUERY SELECTORS
•jQuery selectors are one of the most important parts of the jQuery
library.
•jQuery selectors allow you to select and manipulate HTML
element(s).
•jQuery selectors are used to "find" (or select) HTML elements based
on their name, id, classes, types, attributes, values of attributes
and much more.
•All selectors in jQuery start with the dollar sign and parentheses: $
().
JQUERY EVENT METHODS
jQuery is tailor-made to respond to events in an HTML page.
All the different visitors' actions that a web page can respond to are
called events.
An event represents the precise moment when something happens.
Examples:
moving a mouse over an element
selecting a radio button
clicking on an element
JQUERY EFFECTS
Hide, Show, Toggle, Slide, Fade, and Animate.