Home > Article > Web Front-end > Share an example code for getting the total number of rows in a table using jQuery
Example, jqueryGetTableTotal number of rows:
var row Count = $('#myTable tr').length; var rowCount = $('#myTable >tbody >tr').length; $("#myTable").attr('rows').length; var rowCount = $('table#myTable:last').index() + 1; //Helper function that gets a count of all the rows <TR> in a table body <TBODY> $.fn.rowCount = function() { return $('tr', $(this).find('tbody')).length; }; // USAGE: var rowCount = $('#productTypesTable').rowCount(); alert(jQuery("#jtkList").find("table").eq(0).find("tr").length);
The above is the detailed content of Share an example code for getting the total number of rows in a table using jQuery. For more information, please follow other related articles on the PHP Chinese website!