i want to disable all elements of my class where my checkbox is not checked. But even this is checked, my if returns false.
$('.myClass').each(function(i, obj) {
if (!$j('input[name='+obj.id+']').is(':checked')){
$j('#desc_'+obj.id).attr('disabled','disabled');
}
});
But if i put a alert inside the if, its works!
$('.myClass').each(function(i, obj) {
if (!$j('input[name='+obj.id+']').is(':checked')){
alert($j('input[name='+obj.id+']').is(':checked'));
$j('#desc_'+obj.id).attr('disabled','disabled');
}
});
Anyone knows why?