Tag Archives: getElementsByTagName

How to find the lengtth of array checkbox checked using javascript

var inputTags = document.getElementsByTagName(‘input’);
var checkboxCount = 0;
length = inputTags.length;

for (var i=0;  i<length; i++) {
if (inputTags[i].type == ‘checkbox’ &&  inputTags[i].checked) {
checkboxCount++;
}
}

if(checkboxCount<=0){
alert(‘Some messageg’);

return false;
}