10
rated 0 times
[
13]
[
3]
/ answers: 1 / hits: 76874
/ 12 Years ago, tue, february 26, 2013, 12:00:00
I just want to count the number of rows,
<button id=add>Add row</button>
<table>
<tbody id=mytbody>
</tbody>
</table>
Number of rows: <span id=counter></span>
Javascript:
$(function() {
$('#add').bind('click', function() {
$('#mytbody').after('<tr><td>'+ new Date() +'</td></tr>');
var count = $('#mytbody').children().length;
$('#counter').html(count);
});
});
I found this jQuery: count number of rows in a table
and this doesn't works http://jsfiddle.net/H8sBr/
I just don't get it working.
help?
More From » jquery