lundi 23 mars 2015

in a group of check boxes only allow one to be selected at a time

I want a group of check boxes on a page, when you select a check box I want to clear any other check boxes of checks and just check the one you just clicked on. I have a fiddle that I thought should work, but it never checks the one you clicked on. I don't want to use radio buttons as "no selection" is valid as well



$("#mytable input").change(function(){
$("#mytable input").attr('checked',false);
$(this).attr('checked',true);
})


jsfiddle


Aucun commentaire:

Enregistrer un commentaire