Documentation

Talk:Tutorials:Zebra Striping Made Easy

From jQuery JavaScript Library

Jump to: navigation, search

Filter

I would go further and introduce the notion of sub-queries with filter() in order to minimize DOM searching.

$(".stripeMe tr")
.mouseover(function(){ $(this).addClass("over") })
.mouseout(function(){ $(this).removeClass("over") })
.filter(":nth-child(even)").addClass("alt");

Filter allows to reduce the current working jQuery instead of reselecting it a second time.

--VincentRobert 10:10, 17 January 2008 (PST)