samedi 22 avril 2017

Show Hide button, atleast one checkbox is checked

When I check one or many boxes it shows the buttons "btns" but if i uncheck one it hides them, how do I get it to stay if one or many checkbox is still checked

<input type='checkbox' class='checklist' name='id[]' value='$id' />
<input type='checkbox' class='checklist' name='id[]' value='$id' />
<input type='checkbox' class='checklist' name='id[]' value='$id' />
<input type='checkbox' class='checklist' name='id[]' value='$id' />

$(".btns").hide();

$(".checklist").click(function() {
    if($(this).is(":checked")) {
        $(".btns").show();
    } else {
        $(".btns").hide();
    }
});




Aucun commentaire:

Enregistrer un commentaire