I found this code snippet that seemed to be working, but I tried to implement it and it gave several errors, my question is just how to disable all checkboxes after loading the site.
var filter_form = document.getElementById("filter_form");
var inputs = filter_form.getElementsByTagName("input");
for(var i = 0; i < inputs.length; i++) {
if(inputs[i].type == "checkbox") {
/* If default is checked, but state is not checked, check it*/
if (inputs[i].defaultChecked == true) {
if (inputs[i].checked != true) {
inputs[i].checked = true;
}
/* If defeault not checked, but state is checked, uncheck it */
} else {
if (inputs[i].checked == true) {
inputs[i].checked = false;
}
}
}
}
Aucun commentaire:
Enregistrer un commentaire