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.


Sample DOM Tree

Illustration explained :

  • The div element is the parent of ul, and an ancestor of everything inside of it.
  • The ul element is the parent of both li elements, and a child of div.
  • The left li element is the parent of span, child of ul and a descendant of div.
  • The span element is a child of the left li and a descendant of ul and div.
  • The two li elements are siblings (they share the same parent).
  • The right li element is the parent of b, child of ul and a descendant of div.
  • The b element is a child of the right li and a descendant of ul and div.

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.

You can also search for these topics, how to traversing the data structure, jquery ajax to traversing, what is traversing in jquery selector, what is traversing in jquery html, Example for jquery traversing table, jquery traversing the dom, traversing siblings and parents using jquery, jquery traversing selector, jquery traversing down, filter the traversing the jquery, how to find the jquery traversing, multiple parents used jquery traverse, what does the jquery traversing means, traversing child nodes using jquery.

Traversing the DOM

jQuery provides a number of ways for traversing the DOM.

Tree traversal is the most common type of traversal method.

You can also search for these topics, traverse down the dom in jquery, jquery traversal the dom and manipulation, jquery traverse the dom all child and sibilings nodes, how to get traversing the dom using jquery, check the id of jquery traversing the dom, differenciate the dom vs html methods in jquery traversing, dom parent element to jquery traversal, working of previous siblings in jquery traverse the dom, object to html traversing the dom using jquery.