2 回答

TA贡献1802条经验 获得超4个赞
也许您想要表格的行数。
// javascript
var rowsInTable = document.getElementById("terminalReceipts").getElementsByTagName("tr").length;
//jquery
var rowsInTable2 = $("#customers").children('tbody').children('tr').length;
//if you need to do something with the rows:
var rows = $("#customers").children('tbody').children('tr');
rows.each(function( index ) {
console.log( index + ": " + $( this ).text() );
});

TA贡献1827条经验 获得超8个赞
你也可以像这样使用 jquery 来做到这一点
var totalRowCount = $("#terminalReceipts tr").length; //this will give +1 row
var rowCount = $("#terminalReceipts td").closest("tr").length; //this will give actual row
- 2 回答
- 0 关注
- 154 浏览
添加回答
举报