How to retrieve the Number of Rows in a HTML Table through jQuery?

 Posted by vishalneeraj-24503 on 12/2/2014 | Category: jQuery Interview questions | Views: 2039 | Points: 40
Answer:

Write below code:-
var table_row_count = $('#html_table_id tr').length;

For Example:-
Suppose,i have an HTML table which contains 4 <tr> i.e. rows as below:-
<table id = "html_table_id" style = "border-color:yellow;">   

<tr><td>DOT NET FUNDA.COM ROW1</td></tr>
<tr><td>DOT NET FUNDA.COM ROW2</td></tr>
<tr><td>DOT NET FUNDA.COM ROW3</td></tr>
<tr><td>DOT NET FUNDA.COM ROW4</td></tr>
</table>


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response