mercredi 6 novembre 2019

How to confirm that all checkbox are checked before doing something?

My goal is If all checkbox are check the person can go further if not it will go to an excuse page.

I found this in jQuerry.

$("input[type='checkbox'].itemCheck").change(function(){
    var a = $("input[type='checkbox'].itemCheck");
    if(a.length == a.filter(":checked").length){s
        console.log("Je vais sur la formulaire");

    }
});

i tried it and it work but i need it in vanilla js so i tried to convert it but i just can't find how. I tried other logic to make it work but i can't figure how.

<input type="checkbox" name="verif" class="checkbox itemCheck">

<input type="checkbox"  name="age" class="checkbox itemCheck">

<input type="checkbox"  name="employed" class="checkbox itemCheck">



Aucun commentaire:

Enregistrer un commentaire