dimanche 26 juillet 2020

How to add one to a JS variable each time a certain checkbox is ticked?

I have two classes of checkboxes (.a and .b). When an .a checkbox is clicked, I want one to be added to my js variable (a) and when a .b is clicked I want one to be added to my js variable (b). How would I do this using javascript? My HTML:

<input type = "checkbox" class="a" onclick="a()"> a <br>
            <input type="checkbox" class="b" onclick="b()"> b <br>



Aucun commentaire:

Enregistrer un commentaire