The DOM of a Web page is organized as a tree structure. The elements in the page have family-like names to refer to their positions relative to other elements.
For example, the HEAD and BODY tags are "children" of the HTML tag, and are "siblings" of each other. They have the HTML tag as their "parent". jQuery provides functions for navigating the document tree and processing sets of elements, such as:
children()
: Retrieves all the child elements of the matched elements, except text nodesprev(), next(), parent()
: used to traverse the family relationships of an elementfind()
: search within a given element to find elements that match a selector expressioneach()
: loops over a set of matched elements and calls a function for each one
This is paragraph 1
This is paragraph 2
This is paragraph 3
This is paragraph 4
This is paragraph 5