The best jQuery traversal - offspring Tutorial In 2024, In this tutorial you can learn Traversing the DOM tree down,jQuery children () method,Examples,Examples,jQuery find () method,Examples,Examples,
Descendant is a child, grandson, great-grandchildren, and so on.
By jQuery, you traverse down the DOM tree to find the descendant elements.
Here are two for traversing the DOM tree down jQuery methods:
children () method returns the selected element all the direct child elements.
This method only down one pair DOM tree traversal.
The following example returns each <div> element of all direct child elements:
You can also use the optional parameter to filter the search for the sub-elements.
The following example returns the class name of "1" in all <p> elements, and they are <div> direct child elements:
find () method returns the selected element descendant elements, all the way down to the last descendant.
The following example returns belong <div> all <span> element descendants:
The following example returns <div> all generations: