gigi
gigi

Reputation: 23

Retrieve tr from table

How can i retrieve all the tr with class="ccc" from a table with id"=iii"?

Upvotes: 2

Views: 183

Answers (3)

Mutation Person
Mutation Person

Reputation: 30488

Using the direct child selector will be faster:

$("table#iii>tbody>tr.ccc");

Also, there is no point in table#iiii. An id selector is faster than an element selector, so the following will suffice:

$("#iii>tbody>tr.ccc");

In fact, if you can add an ID to your row (e.g. MyRow) then you can bypass this alltogether, cutting down considerably the amount of DOM traversing you have to do

$("#MyRow");

Upvotes: 0

Kieran Senior
Kieran Senior

Reputation: 18220

$("table#iii tr.ccc")

Upvotes: 2

Tom
Tom

Reputation: 1115

var rows = $('table#iii tr.ccc');

Upvotes: 2

Related Questions