I have 5 checkboxes in each row. The first one is 'ALL'. I am trying to see if any of the others are disabled. So, if somebody clicks on 'ALL' checkbox, I need to make sure the disabled ones are not checked. This is what I have:
("input[name^=all_]").each(function() {
var input = $(this);
var name = input.attr('name');
var num = /\d+$/.exec(name)[0];
$(this).click(function() {
if ($('"#G"+num').attr('disabled',false)) {
$("#G"+num).attr('checked', $("#all_"+num).is(':checked'));
}
if ($('"#E"+num').attr('disabled',false)) {
$("#E"+num).attr('checked', $("#all_"+num).is(':checked'));
}
if ($('"#W"+num').attr('disabled',false)) {
$("#W"+num).attr('checked', $("#all_"+num).is(':checked'));
}
if ($('"#S"+num').attr('disabled',false)) {
$("#S"+num).attr('checked', $("#all_"+num).is(':checked'));
}
});
});
The thing is, the disabled ones still gets checked once I click on 'ALL'. what am i doing wrong? thanks in advance.