abc

Share This blog with your friends, so that we can improve more & more . our aim is to easy & simple way of learning.

5/06/2018

jQuery Traversing

hi,

what is jquery traversing,
traversing is used to find specific div such as particular div of parent class by moving through whole class.

 this basically change DOM , also effect on ancestor, descendants, siblings
for example

$(document).ready(function(){
    $(".abc").parent().css({"color": "red", "border": "4px solid red"});
});

 basically following method ,
1. parent()
2. parents()
3. children()
4. find()
5. parentsuntil()
6.  siblings()
7.   next()
8.  nextAll()
9.  nextUntil()
10  prev()
11 prevAll()
12 prevUntil()

in above parent() method is use for getting direct parent class in above example apply red color style abc parent div .
similarly parents is use for multiple surrounded or all div that cover children div.
children()
eg:  $('.may').children().css('color': 'yellow');

 in similar way if you want to find specific div
$('#ab').find("span").css('border','2px solid green');
 above example shows border color green for span find in ab div
 $("div").find("*");
to find all element in div .


 

An Introduction to the Laravel Framework: What It Is and Why You Should Use It

  If you're a PHP developer looking for a modern, efficient, and powerful framework to build web applications, look no further than Lara...