Category: Traversing
-
Traversing Descendants
jQuery provides methods to traverse downwards inside the DOM tree to find descendant(s) of a given element. These methods can be used to find a child, grandchild, great-grandchild, and so on for a given element inside the DOM. There are following three methods to traverse downwards inside the DOM tree: The children() method differs from find() in that children() only travels…
-
Traversing Ancestors
jQuery provides methods to traverse upwards inside the DOM tree to find ancestor(s) of a given element. These methods can be used to find a parent, grandparent, great-grandparent, and so on for a given element inside the DOM. There are following three methods to traverse upward inside the DOM tree: jQuery parent() Method The jQuery parent() method…
-
DOM Traversing
jQuery is a very powerful tool which provides a variety of DOM traversal methods to help us select elements in an HTML or XML document randomly as well as in sequential method. Elements in the DOM are organized into a tree-like data structure that can be traversed to navigate, locate the content within an HTML…