javascript traversing table
- by user234194
If I have a certain code, How do I traverse or get to the button(i.e type == INPUT) in JavaScript.
<td> <div>
<script></script>
<script></script>
<script></script>
<input type="button"....../>
</div></td>
I tried doing:
var cell = row.cells[0];
if (cell) {
var btn1 = cell.firstChild;
alert(btn.tagName.toUpperCase());
this resulted "DIV", and
var cell = row.cells[0];
if (cell) {
var btn = btn1.firstChild;
alert(btn.tagName.toUpperCase());
this resulted "SCRIPT"
But doing same (i.e firstChild ) , I could not succeed.
Any help is appreciated.
Thanks