jQuery Traversing
What is Traversing?
jQuery traversal, which literally means "move through", is used to "find" (or select) HTML items based on their relationships with other elements. Start with one option and work your way through it until you find the elements you want.
The picture below shows an HTML tree page (DOM tree). By crossing jQuery you can quickly move up (ancestors), down (descendants) and sideways (siblings) from the selected (current) element in your tree. This movement is known as the DOM Tree, which crosses or passes.

Illustration explained :
- The
div
element is the parent oful
, and an ancestor of everything inside of it. - The
ul
element is the parent of bothli
elements, and a child ofdiv
. - The left
li
element is the parent ofspan
, child oful
and a descendant ofdiv
. - The
span
element is a child of the leftli
and a descendant oful
anddiv
. - The two
li
elements are siblings (they share the same parent). - The right
li
element is the parent ofb
, child oful
and a descendant ofdiv
. - The
b
element is a child of the rightli
and a descendant oful
anddiv
.
A parent, grandparent, great-grandparent, and so on are all examples of ancestors.
A descendant is defined as a child, grandchild, great-grandchild, and so on.
The parent is shared by siblings.
Related Links
Traversing the DOM
jQuery provides a number of ways for traversing the DOM.
Tree traversal is the most common type of traversal method.
Related Links