I have a form that have 4 checkbox with different id. the problem is when i 'select all'for a particular checkbox, it checked on all checkbox inside the form even it is not the same id. for example, the first checkbox id is 'check', the 2nd checkbox id is 'jenis_cukai_', the 3rd checkbox id is 'check_' and the last checkbox id is 'bon'. the 1st checkbox is place at the header of the 2nd checkbox since it is for me to select all data of it. but the problem it when i click on it, the 3rd and the 4th checkbox also being check at once.
this is the js code that i used.
function checkedAll () {
document.baucar.flag_tanggungan.value = 1;
if (checked == false){checked = true;}else{checked = false;}
for (var i = 0; i < document.getElementById('baucar').elements.length; i++) {
document.getElementById('baucar').elements[i].checked = checked;
document.baucar.flag_tanggungan.value = 0;
}
}
how can i fix this?
Aucun commentaire:
Enregistrer un commentaire