javascript set all checkbox true

javascript set all checkbox true

1
2
3
4
5
6
var inputs = document.getElementsByTagName("input"); //or document.forms[0].elements;
for (var i = 0; i < inputs.length; i++) {
if (inputs[i].type == "checkbox") {
inputs[i].checked = true;
}
}