I would like to count the checkboxes that are checked and display the count in the Div.
Here is my HTML :
<form name="liste_figurine" method="post">
<input type="checkbox" id="radio-1" class="z" name="chck1[]" onclick="updateCount()" />
<input type="checkbox" id="radio-2" class="z" name="chck2[]" onclick="updateCount()" />
</form>
<div id="y"></div>
Here is my JS :
function updateCount {
var x = $(".z:checked").size();
document.getElementById("y").innerHTML = x;
};
Here is an exemple : http://ift.tt/2oA3PN4
Sorry, I'm not really used to JS... What is wrong with my code ?
Aucun commentaire:
Enregistrer un commentaire