Select All Radio Buttons, Except for Disabled Ones
Select All Radio Buttons, Except for Disabled Ones
kraftomatic
Posts: 78Questions: 13Answers: 0
Hey Allan,
I have this function you helped me with:
table.$('tr').each( function () {
$('input:eq('+(index+1)+')', this).attr('checked', true).change();
} );
I'm trying to add a simple logic check, so that if the radio button is disabled, it will not be selected. I believe I want to use the :disabled filter, and I think it can be used cleanly within one line (without an if/else check), but I'm not sure the best way to do it.
Any suggestions?
Thanks.
I have this function you helped me with:
table.$('tr').each( function () {
$('input:eq('+(index+1)+')', this).attr('checked', true).change();
} );
I'm trying to add a simple logic check, so that if the radio button is disabled, it will not be selected. I believe I want to use the :disabled filter, and I think it can be used cleanly within one line (without an if/else check), but I'm not sure the best way to do it.
Any suggestions?
Thanks.
This discussion has been closed.
Replies
[code]
$('input:eq('+(index+1)+')', this).filter(':not(:disabled)').attr('checked', true).change();
[/code]
( not actually tested, but I think it should work :-) )
Allan