Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get <td> id using javascript

Status
Not open for further replies.

sarathy1234

Programmer
May 25, 2008
2
NO
Hi all,


Using javascript how to get the TD id values using the TR id that should work in all browsers.

For Example:


<table id="table1>
<tr id="row1">
<td id="r_c_1_1">Row One</td>
<td id="r_c_1_2">Row One</td>
<td id="r_c_1_3">Row One</td>
</tr>

<tr id="row2">
<td id="r_c_2_1">Row Two</td>
<td id="r_c_2_2">Row Two</td>
<td id="r_c_2_3">Row Two</td>
</tr>
</table>


Thanks in advance
 
Modify the highlighted values to adjust for different <td> elements.
Code:
document.getElementById("table1").rows[[!]0[/!]].cells[[!]0[/!]].id

-kaht

Google is gobbling up the Internet - electricphp

Finally, <. is a good thing!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top