mardi 21 mai 2019

jQuery Checkboxs as radio buttons with ability to uncheck all

I have a series of checkboxes that act as radio buttons. These need to stay checkboxes rather than radio buttons, to be consistent with other checkboxes in the same group. The question is what to do when a user wants to uncheck all after making a selection. My solution does not allow for this. Clicking on a selected checkbox simply remains checked.

$(".OverLen").on("click", function()
{
    Current = this.id;
    if($("#"+Current).prop("checked", true))
    {
        $(".OverLen").prop("checked", false);
        $("#"+Current).prop("checked", true);
    }
});




Aucun commentaire:

Enregistrer un commentaire