Javascript access TR from TD

Posted by arik-so on Stack Overflow See other posts from Stack Overflow or by arik-so
Published on 2010-03-26T15:16:18Z Indexed on 2010/03/26 15:23 UTC
Read the original article Hit count: 192

Filed under:
|
|
|
|

Hello. I have a table row, and within that, I have a td (whatever it stands for). I want, without an ID or a name, to be change the class attribute of the TR my TD is in. Like that:

<tr>
<td onclick="[TR].setAttribute('class', 'newName')">My TD</td>
</tr>

How do I do it?

© Stack Overflow or respective owner

Related posts about html

Related posts about JavaScript