HTML document traversal & manipulation, event handling, animation, and Ajax are simpler by using the APIs in the jQuery library.
Designed to work across a multitude of browsers.
Document Object Model, or DOM
The DOM is a tree structure with the HTML document as the root object. The root can have several children, and those children can have several children. For example, a web page that contains a list would have a root object, with a child list object that contained several child list element objects.
The jQuery syntax is made for selecting HTML elements and performing some action on the element(s).
Basic syntax is: $(selector).action()
- $ sign to define and access jQuery
- (selector) to query or find the HTML element(s)
- action() to be performed on the HTML element(s)
- $(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”