lundi 19 octobre 2015

Hide and Show radio buttons with checkbox

Basically i'd like hide and show the radio buttons if the checkbox is checked or not, but with some conditions.

  1. The first radio button need to be checked by default even if hiden.

  2. If the checkbox as checked then i can choose another radio if necessary.

  3. But, if the checkbox is unchecked, so the radio button back to the first checked by default.

I tried to modify some solutions that i found, but without success :(

My HTML:

<input name="featured_ad" value="1" type="checkbox">condition
<div class="buttons">
    <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>
</div>

Thanks a lot!




Aucun commentaire:

Enregistrer un commentaire