dimanche 16 mai 2021

How to create a checkbox that uncheckes the other boxes when checked and unckeckes itself when you try to check the others again [closed]

I would like to create a checkbox that is like a none option and if that is selected then the other checkboxes should get unchecked and if I try to check the other checkboxes the none checkbox should uncheck.

It's like if I ask which fruit the user like he should be able to give an answer of the corresponding fruits or he can select the last option so basically I don't want the last option to be checked if the user checked the first 3 options.

<label for="a">
<input id="a" type="checkbox" name="abcd" value="a" >
Fruit_1</label>
<label for="b">
<input id="b" type="checkbox" name="abcd" value="b" >
Fruit_2</label>
<label for="c">
<input id="c" type="checkbox" name="abcd" value="c" >
Fruit_3</label>
<label for="d">
<input id="d" type="checkbox" name="abcd" value="d" >
I don't like fruits</label>

It's not like a master check box. I need it to uncheck the boxes when it's checked and it should uncheck itself if 1 of the other check boxes are checked.

Your Time and effort is greatly appreciated.




Aucun commentaire:

Enregistrer un commentaire