0

Hi,

I have the following code which aims to change the color of a parent div when the user unselects the radio button. However it doesn't work.

<div class="jquerycorner"><input type="radio" name="hat" value="4" onblur="if(!this.checked) { this.parentNode.style.backgroundColor='#000000';}">10</div>

However the following code works when I try to detect radio button selection.

<div class="jquerycorner"><input type="radio" name="hat" value="1" onclick="this.parentNode.style.backgroundColor='#FFC0CB';">5</div>

Any ideas?

2
Contributors
2
Replies
5
Views
7 Years
Discussion Span
Last Post by halukakin
0

nope, but will keep working on it.

why dont u rather implement a function on the onlick event.
I personally dont like using the onblur event.

0

Thanks Thirusha,

I indeed solved the problem using an onclick event.

Thank you!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.