May 07, 2021 jQuery
jQuery traversal, meaning "move," is used to "find" (or pick) HTML elements based on their relationship to other elements. Start with a selection and move along it until you reach the element you expect.
The following image shows a family tree. W ith jQuery traversal, you can easily move up (ancestor), down (children), and horizontally (compatriot) in the family tree, starting with the selected (current) element. This movement is called traversal of the DOM.
Illustration:
The ancestors were fathers, grandfathers, great-grandfathers, and so on. F uture generations are children, grandchildren, great-grandchildren, and so on. Fellow citizens have the same father. |
jQuery provides a variety of ways to traverse the DOM.
The largest type of traversal method is tree traversal.
The next chapter explains how to move up, down, and at the same level in the DOM tree.