2011-04-13 102 views
0

我有一個頁面上使用tablesorter的多個表格,但只需要顯示每個表格上的前5個結果。jQuery在多個表格上顯示5條記錄

我試圖擴大這個,但它只保留第一個表中的第一個。我需要在每張桌子上完成。

$('.tablesorter > tbody').children('tr:not(:first)').remove();

回答

1
$('.tablesorter > tbody')each(function(){ 
    $(this).children('tr:lt(5)').remove(); 
}); 
+0

感謝每一個尋找,尋找我也終於找到這個參考。 http://stackoverflow.com/questions/1874554/jquery-tr-add-class-after-first-5-rows – David 2011-04-13 16:09:51