How to count checked ckeckbox using onclick even ref by id ?
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