How to find the parent element using javascript
- by Kalpana
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.