mercredi 16 mars 2016

Javascript count checked checkbox and not count another checkbox

I'm trying to have JavaScript count one set of checkboxes and not count a set of checkboxes.

Right now I have the following JavaScript code:

function updateCount {
    var count = $("input[type=checkbox]:checked").size();
    $("#count").text(count);    
};
});

Here are my checkboxes:

<input type="checkbox" name="checkbox_1">Checkbox 1
<input type="checkbox" name="checkbox_2">Checkbox 2

So basically with my JavaScript is there a way to only count the first checkbox but not the second checkbox.




Aucun commentaire:

Enregistrer un commentaire