I pre-load a table with all of its rows. However, I only want to show only the top 10 rows that are within the
1) If you need the tr tags not only with the tbody tag then rewrite your jquery select to 2) You can get the number of rows and use that count in the slice 3) Check the count of hidden rows in the seeMoreRecords click event handler 4) Check the count of shown rows tag and now every <
$("#internalActivities > table tr");
var $records = $("#internalActivities tr");
$records.slice($records.length - 10, $records.length).hide();
if ($("#internalActivities tr:hidden").length === 0) {
$("#seeMoreRecords").hide();
}
if ($("#internalActivities tr").not(":hidden").length <= 10) {
$("#seeLessRecords").hide();
}