Reputation:
How would I access all of the tds in a tr, knowing only the tr index. I am hoping to do this with the jQuery nth-child selector.
Upvotes: 6
Views: 11394
Reputation: 13381
$("table tr:nth-child(x) td");
This will return all the td within the x you set
Upvotes: 0
Reputation: 342795
The uber-speedy .eq
filter method is one way.
var $cells = $("#table tr").eq(index).find("td");
Upvotes: 6
Reputation: 171924
$("table tr:eq(5) td")
This returns all td elements in the 6th row of a table
Upvotes: 12