jQuery Traversal
- Previous page jQuery Size
- Next page jQuery Ancestor
What is traversal?
jQuery traversal, meaning 'move', is used to 'find' (or select) HTML elements based on their relationship to other elements. Start with a selection and move along this selection until you reach the element you expect.
The following diagram shows a family tree. Through jQuery traversal, you can easily move up (ancestors), down (descendants), and horizontally (siblings) in the family tree starting from the selected (current) element. This kind of movement is called traversing the DOM.
Illustration Explanation:

- <div> Elements are parent elements of <ul>, and also ancestors of all the content within.
- <ul> Elements are parent elements of <li> elements, and also child elements of <div>.
- The left <li> element is the parent element of <span>, the child element of <ul>, and also a descendant of <div>.
- <span> Elements are child elements of <li>, and also descendants of <ul> and <div>.
- The two <li> elements are siblings (they have the same parent element).
- The right <li> element is the parent element of <b>, the child element of <ul>, and also a descendant of <div>.
- <b> Elements are child elements of the right <li>, and also descendants of <ul> and <div>.
Tip:Ancestors are parent, grandparent, great-grandparent, and so on. Descendants are children, grandchildren, great-grandchildren, and so on. Siblings have the same parent.
Traverse DOM
jQuery provides various methods for traversing the DOM.
The largest category of traversal methods is tree traversal (tree-traversal).
The next chapter will explain how to move up, down, and horizontally in the DOM tree.
jQuery Traversal Reference Manual
To learn about all jQuery traversal methods, please visit our jQuery Traversal Reference Manual.
- Previous page jQuery Size
- Next page jQuery Ancestor