Wednesday, 28 August 2013

jquery count on table length returning incorrect value

jquery count on table length returning incorrect value

I am trying to count the number of rows in my table. When I test via the
console, here's what I get:
$("#rule_summary").html();
"
<thead>
<tr>
<th><b>Actions</b></th><th><b>Contact
Type</b></th><th><b>Contact Number</b></th><th><b>Call
Order</b></th><th><b>Text</b></th>
</tr>
</thead>
<tbody>
<tr>
<td>
<a href="" class="delete">Delete</a>
</td>
<td> Home Number</td>
<td> 4442</td>
<td> 1</td>
<td> no </td>
</tr>
<tr>
<td>
<a href="" class="delete">Delete</a>
</td>
<td> M Number</td>
<td> 28507</td>
<td> 2</td>
<td> yes </td>
</tr>
</tbody>
"
And here's what the count is (console debug as well)
$("#rule_summary").length
1
I've been reviewing the code to make sure my table is formatted
properly... I can't see anything wrong with it.. but maybe another pair of
eyes will find something. Any suggestions?
Thanks.

No comments:

Post a Comment