vendredi 15 mars 2019

Group of checkbox with initial state

I have two checkbox.

<label><input type="checkbox" name="cb1" class="chbR" /> % Retain</label>
<label><input type="checkbox" name="cb2" class="chbP" /> % Passing</label>

Only one of both can be selected as the same time

If cb1 is selected and user click cb1, cb1 need to be unselected If cb2 is selected and user click cb2, cb2 need to be unselected

If cb1 is selected and user click cb2, cb1 need to be unselted If cb2 is selected and user click cb1, cb2 need to be unselted http://jsfiddle.net/5o47bgzc/

tried with click and change event but it's like a third state is needed

when the event occur, previous state is not available

any other way to do it?




Aucun commentaire:

Enregistrer un commentaire