Using Javascript, how can I access a specific child of a row? Javascript (not jQuery please).
e.g.: second <TD>
of <TR>
where ID=id33322010100167
<table>
<tr id="id33322010100167">
<td>20101001</td>
<td>918</td>
<td>919</td>
<td>67</td>
<td>CAR PROBLEM</td>
</tr>
<tr id="id33322010100169">
<td>20102001</td>
<td>913</td>
<td>914</td>
<td>62</td>
<td>LUNCHTIME</td>
</tr>
<table>
var index = 1; // second element
var child = document.getElementById('id33322010100167').childNodes[index]
Maybe you can try this:
var tRow = document.getElementById("tableName").getElementsByTagName("tr");
for(var i = 0; i < tRow.length; i++){
if(tRow[i].id == "name of your id"){
//do something
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With