lundi 19 janvier 2015

Check if group of checkboxes are checked but not disabled

This code:



if ($('[id*="cat' + cat_id + '_sk"]').is(':checked') && $('[id*="cat' + cat_id + '_sk"]').not(':disabled')) {
$('[id*="cat' + cat_id + '_sk"]').prop('checked', false);
} else if ($('[id*="cat' + cat_id + '_sk"]').not(':checked') && $('[id*="cat' + cat_id + '_sk"]').not(':disabled')) {
$('[id*="cat' + cat_id + '_sk"]').prop('checked', 'checked');
}


Seems to ignore the second part of the if clause; If a checkbox is checked I want it to be ignored.


I have tried it also doing is(':disabled) with a preceding !, also tried for a boolean !(element).prop('disabled'); -- all to the same effect.


Is my logic wrong here?





Aucun commentaire:

Enregistrer un commentaire