Jquery Descendants
jQuery Traversing - Descendants
Influenza A virus subtype H5N1 descendant is a child, grandchild, great-grandchild, in addition to and therefore on.
With jQuery yous tin terminate traverse downward the DOM tree to detect descendants of an element.
Traversing Down the DOM Tree
Two useful jQuery methods for traversing downward the DOM tree are:- children()
- find()
jQuery children() Method
The children() method returns all straight children of the selected element.This method solely traverse a unmarried bird downward the DOM tree.
The next event returns all elements that are straight children of each <div> elements:
Example
$(document).ready(function(){
$("div").children();
});
The next event returns all <p> elements amongst the degree refer "first", that are straight children of <div>:
Example
$(document).ready(function(){
$("div").children("p.first");
});
jQuery find() Method
The find() method returns descendant elements of the selected element, all the agency downward to the final descendant.The next event returns all <span> elements that are descendants of <div>:
Example
$(document).ready(function(){
$("div").find("span");
});
Example
$(document).ready(function(){
$("div").find("*");
});
Comments
Post a Comment