Reputation: 20004
Here is some code that checks if a radio button is disabled. How do I reform this to make the radio unchecked if it is currently disabled? And yes I still want to remove the parent CSS class. Thanks.
$('input:disabled', true).parent().removeClass("style1");
Why won't this work?
$('input:disabled', true).attr('checked', false).parent().removeClass("style1");
Upvotes: 2
Views: 3036
Reputation: 382696
How do I reform this to make the radio unchecked if it is currently disabled?
You could do:
$(':radio').each(function(){
if ($(this).is(':disabled')) {
$(this).attr('checked', false);
}
});
More Info:
Upvotes: 2