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?