I am trying to check all checkboxes by onclick event on a checkbox labeled 'Select All'. The code is working fine in FF,Chrome but not working in IE. The code is as below:
<script type="text/javascript">
function toggle(source) {
checkboxes = document.getElementsByName('category');
for(var i in checkboxes)
checkboxes[i].checked = source.checked;
}
</script>
<input type="checkbox" name="selectAll" id="selectAll" onClick="javascript :toggle(this)" />Select All Categories
<input type="checkbox" name="category" id="category1" />category1
<input type="checkbox" name="category" id="category2" />category2
<input type="checkbox" name="category" id="category3" />category3
Any help would be appreciated.