且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

jQuery:计算表中的行数

更新时间:2023-02-06 10:56:39

使用将选择所有行并占用长度的选择器。

Use a selector that will select all the rows and take the length.

var rowCount = $('#myTable tr').length;

注意:这种方法还会计算每个嵌套表的所有tr!

Note: this approach also counts all trs of every nested table!