HisMightiness
Programmer
I have a script where I return true if any checkboxes are checked. However, it only works in IE. Firefox throws an error on the For loop line. It says that "col has no properties".
How can I ammend this to make it cross-browser compatible?
Here is the snippet:
function areAttractionCheckboxesSelected(){
var ctrl = document.getElementById('checkboxname');
var col = ctrl.all;
for (i = 0; i < col.length; i++){
if (col.tagName.toUpperCase() == 'INPUT'){
if(col.checked){
return true;
}
}
}
return false;
}
Will
How can I ammend this to make it cross-browser compatible?
Here is the snippet:
function areAttractionCheckboxesSelected(){
var ctrl = document.getElementById('checkboxname');
var col = ctrl.all;
for (i = 0; i < col.length; i++){
if (col.tagName.toUpperCase() == 'INPUT'){
if(col.checked){
return true;
}
}
}
return false;
}
Will