How to find the parent element using javascript
Posted
by Kalpana
on Stack Overflow
See other posts from Stack Overflow
or by Kalpana
Published on 2010-03-16T12:38:28Z
Indexed on
2010/03/16
12:46 UTC
Read the original article
Hit count: 298
I want to change the background color of the table cell when radio button inside the cell is clicked.
<table>
<tr>
<c:forEach items="#{books}" var="book">
<td align="center">
<h:selectOneRadio value="#{book.price}" onclick="this.parentElement.style.background-color='red';">
<f:selectItems value="#{books.getDetails()}" />
</h:selectOneRadio>
</td>
</c:forEach>
</tr>
</table>
How to get the parent element reference.
© Stack Overflow or respective owner