Multiple Select All checkbox using Jquery not working on Internet Explorer.

Multiple Select All checkbox using Jquery not working on Internet Explorer.

Hi,

I have a table, containing 3 columns having checkboxes. I have created 3 different Select All checkboxes as header for each of them, which should select respective checkboxes only.

Could someone please let me know, whats wrong with the below piece of code, as it's not compatible with IE.
The same code works fine on Firefox & Chrome.

Error Message from IE: Object doesn't support this property or method

JQuery Code:

function toggle(source) {
  var checkboxes = document.querySelectorAll('input[type=checkbox][name*='+source.name+']');
  for(var i in checkboxes){
    checkboxes[i].checked = source.checked;
}
}

Could you please help me in getting this fixed or find out another alternative?
Is it possible to select all checkbox using classes?