I have such piece of code. I have 4 sets of checkboxes on a form and each set has to go through this function separately. ID variable is an id of a given div placed around each set
$('#'+id+' input[type=checkbox]:checked').each(function() {
var value = $(this).val();
(...)
});
Works fine on chrome, firefox and IE9. Doesn’t work on IE7/8.
What works on IE7/8 tho is this
$('input[type=checkbox]:checked').each(function() {
var value = $(this).val();
(...)
});
So it works without div identifier. I still need to be able to tell IE7/8 which set of checkboxes I want it to go through. How should I accommodate that div identifier so it works on older IEs?
If checkboxes are organized in groups or sets, the way I usually do this is adding an array name to the checkbox group and use that in jQuery.
And in jQuery: