I am trying to change the text of a table cell when only the <table> element has an ID, there are no IDs set on the cells, e.g.
<table id="test">
<tbody>
<tr>
<td>Cell 1</td>
<td>Cell 2</td>
</tr>
</tbody>
</table>
So how do I change the text of the second cell (Cell 2) in Javascript without explicitly specifying an ID for it?
Thanks,
AJ
It’s really easy to do with jQuery, but I’m assuming you want to use native DOM methods. In that case,
will get you to the 2nd table cell in that table.
https://developer.mozilla.org/en/Traversing_an_HTML_table_with_JavaScript_and_DOM_Interfaces