I am trying to make a function to check if all checkboxes are unchecked. I have a similar function for text boxes. As I have not worked with checkboxes much before, I’m not sure how to adapt it except for changing input[type=text] to input[type=checkbox].
Can anyone help me out? Thanks.
var textinputs = document.querySelectorAll('input[type=text]');
var empty = [].filter.call( textinputs, function( el ) {
return !el.value
});
if (textinputs.length == empty.length) {
alert("None filled");
return false;
}
The following should do the trick: