How to get an HTML table rows count when it contains tbody on HTML layout?

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

We can write below code:-
var table_rows_cnt = document.getElementById('your_table_id').getElementsByTagName('tbody')[0].getElementsByTagName('tr').length;

alert(table_rows_cnt);


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response