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 關注
- 139 瀏覽
添加回答
舉報