What is Traversing?
jQuery navigating, which implies "move through", are utilized to "find" (or select) HTML components dependent on their connection to different components. Begin with one choice and travel through that determination until you achieve the components you desire.
The picture beneath outlines a family tree. With jQuery navigating, you can effectively climb (progenitors), down (relatives) and sideways (kin) in the family tree, beginning from the chosen (current) component. This development is called crossing - or moving through - the DOM.
- The <div> component is the parent of <ul>, and a ancestor of everything within it
- The <ul> component is the parent of both <li> components, and a child of <div>
- The left <li> component is the parent of <span>, child of <ul> and a descendant of <div>
- The <span> component is a child of the left <li> and a descendant of <ul> what's more, <div>
- The two <li> components are siblings (they share the equivalent parent)
- The right <li> component is the parent of <b>, child of <ul> and a descendant of <div>
- The <b> component is a child of the privilege <li> and a descendant of <ul> also, <div>
Traversing the DOM
jQuery gives an assortment of strategies that enables us to navigate the DOM.
The biggest class of traversal techniques are tree-traversal.
The next sections will tell us the best way to go up, down and sideways in the DOM tree.
jQuery Traversing Reference
For a total review of all jQuery Traversing techniques, it would be ideal if you go to our jQuery Traversing Reference.