lundi 19 octobre 2015

Check and Uncheck a checkbox using radio buttons conditions

Basically i'd like to control a checkbox using the radio buttons bellow as condition. If i check the checkbox, the first radio would be checked. If i change to another radio button, the checkbox still checked.

But, if i uncheck the checkbox, i would like to uncheck any radio button. I mean, the radio buttons need to be checked if the checkbox is checked, and if the checkbox is unchecked, the radio buttons need to be unchecked as well.

I've tried a bunch of partial solutions, but anyone works fine :(

My HTML:

<input name="featured_ad" value="1" type="checkbox">condition
<br><br>
<input type="radio" name="ad_pack_id" value="497649">value 1<br>
<input type="radio" name="ad_pack_id" value="497648">value 2<br>
<input type="radio" name="ad_pack_id" value="497647">value 3<br>

Thanks a lot!




Aucun commentaire:

Enregistrer un commentaire