How do I iterate through table rows and cells in javascript?
Posted
by GregH
on Stack Overflow
See other posts from Stack Overflow
or by GregH
Published on 2010-06-17T20:22:27Z
Indexed on
2010/06/17
20:33 UTC
Read the original article
Hit count: 188
JavaScript
If I have an HTML table...say
<div id="myTabDiv">
<table name="mytab" id="mytab1">
<tr>
<td>col1 Val1</td>
<td>col2 Val2</td>
</tr>
<tr>
<td>col1 Val3</td>
<td>col2 Val4</td>
</tr>
</table>
</div>
How would I iterate through all table rows (assuming the number of rows could change each time I check) and retrieve values from each cell in each row from within Javascript?
© Stack Overflow or respective owner