Get the number of rows in a HTML table

Viewed 154786

I've browsed the Internet looking for an answer on this but I can't find a solution. I want to count the amount of rows my HTML table has in when a link button is pressed. Can someone help me out please?

This is what I have so far:

 $('#HypSelectAll').click(function () {
     var count = $('#gvPerformanceResult').children().length;
     for (i = 0; i < count; i++) {
        alert(i);
     }
 });

But some reason it returns 0 even though I have about 12 rows in my table? I've checked my ID name and it's correct.

5 Answers
Related