samedi 17 janvier 2015

How to count checked ckeckbox using onclick even ref by id?

How to count checked ckeckbox using onclick even ref by id ?


http://ift.tt/15inozr


Html is



<div id="yyy">
<input type="checkbox" id="check_id" onclick="xxx()" checked>
<input type="checkbox" id="check_id" onclick="xxx()">
<input type="checkbox" id="check_id" onclick="xxx()">
<input type="checkbox" id="check_id" onclick="xxx()" checked>
<input type="checkbox" id="check_id" onclick="xxx()">
<div>


and javascript is



function xxx()
{
var zzz = document.getElementById("check_id").length;
alert(zzz);
}




Aucun commentaire:

Enregistrer un commentaire