Jquery Traversing

jQuery Traversing


What is Traversing?

jQuery traversing, which agency "move through", are used to "find" (or select) HTML elements based on their relation to other elements. Start alongside 1 alternative in addition to deed through that alternative until y'all accomplish the elements y'all desire.
The ikon below illustrates an HTML page equally a tree (DOM tree). With jQuery traversing, y'all tin hand notice easily deed upwards (ancestors), downwards (descendants) in addition to sideways (siblings) inwards the tree, starting from the selected (current) element. This crusade is called traversing - or moving through - the DOM tree.
  HTML elements based on their relation to other elements jQuery Traversing
Illustration explained:
  • The <div> chemical ingredient is the parent of <ul>, in addition to an ancestor of everything within of it
  • The <ul> chemical ingredient is the parent of both <li> elements, in addition to a child of <div>
  • The left <li> chemical ingredient is the parent of <span>, child of <ul> in addition to a descendant of <div>
  • The <span> chemical ingredient is a child of the left <li> in addition to a descendant of <ul> in addition to <div>
  • The ii <li> elements are siblings (they percentage the same parent)
  • The correct <li> chemical ingredient is the parent of <b>, child of <ul> in addition to a descendant of <div>
  • The <b> chemical ingredient is a child of the correct <li> in addition to a descendant of <ul> in addition to <div>
An ancestor is a parent, grandparent, great-grandparent, in addition to and hence on.
A descendant is a child, grandchild, great-grandchild, in addition to and hence on.
Siblings percentage the same parent.

Traversing the DOM

jQuery provides a diversity of methods that let us to traverse the DOM.
The largest category of traversal methods are tree-traversal.
The side past times side chapters volition exhibit us how to go up, downwards in addition to sideways inwards the DOM tree.


Comments

Popular posts from this blog

What Are The Main Components of a Computer System

Top Qualities To Look For In An IT Support Team

How To Integrate Google Adwords Api Into Codeigniter?