How can i retrieve all the tr with class="ccc" from a table with id"=iii"?
A:
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");
James Wiseman
2010-02-01 10:41:30
Adding the same ID to each row would cause a W3C validation error, every ID should be unique.
asrijaal
2010-02-01 11:51:36