Thursday, October 27, 2011

Jquery's Chaining capability

with jquery's chaining capability,we can get multiple sets of elements and do multiple thing with them
$('td:contains("Henry")') //get every cell containing "Henry"
.parent() //get its parent
.find('td:eq(1)') //find inside the parent the 2nd cell
.addClass(highlight') //add the "highlight" class to that cell
.end() //revert back to the parent of the cell containing "Henry"
.find('td:eq(2)') //find inside the parent the 3rd cell
.addClass('highlight'); //add the "highlight" class to that cell

No comments:

Post a Comment