jeudi 20 mai 2021

How to create a none checkbox that unchecked other checkboxes if it's selected

How do I create a check box that's none of the above so when I check that option the remaining checkboxes should get unchecked and if I try to check the other options the none checkbox should be unchecked automatically.

It should also be that if the none checkbox is unchecked it should force the user to check atleast 1 of the remaining boxes.

<label for="box1">
<input id="box1" type="checkbox" name="nums" value="1" >
item 1</label>
<label for="box2">
<input id="box2" type="checkbox" name="nums" value="2" class="check">
item2</label>
<label for="box3">
<input id="box3" type="checkbox" name="nums" value="3" class="check">
item3</label>
<label for="box4">
<input id="box4" type="checkbox" name="nums" checked="checked" value="none">
none of the above</label>



Aucun commentaire:

Enregistrer un commentaire