[Solved] How to count number of rows in a table when table row is added dynamically [closed]


The DOM element for the <table> will have a rows collection:

document.getElementById('table-id').rows.length;

You can also select the rows in supporting browsers:

document.querySelectorAll('#table-id > tr').length;

Or if you’re using a library such as jQuery:

$('#table-id > tr').length;

5

solved How to count number of rows in a table when table row is added dynamically [closed]