Reputation: 249
This works:
$("#topTable tr[data-mainRow]:even").find("td:first").addClass("zibraBackground");
However, how can I identify the additional td's within this row, example, td 2 and td 3 using the method above...
Upvotes: 0
Views: 403
Reputation: 981
You can also use CSS-like :nth-child(k)
. Example:
var tr = $("#topTable tr[data-mainRow]:even");
tr.find("td:nth-child(1)").doSomething();
tr.find("td:nth-child(2)").doSomething();
tr.find("td:nth-child(3)").doSomething();
The indexes start at 1 not 0.
Upvotes: 0
Reputation: 332
What you are looking is the pseudo selector :eq(n)
where n is the index of the element you want to get.
http://api.jquery.com/eq-selector/
Upvotes: 1