Retrieve tr from table
How can i retrieve all the tr with class="ccc" from a table with id开发者_开发知识库"=iii"?
var rows = $('table#iii tr.ccc');
$("table#iii tr.ccc")
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");
精彩评论