I have this example which works great. The buttons are disabled as default and if there is a radio button change to yes then the corresponding button is enabled. The problem is i need it to go back to disabled if they switch it back. The only time it should be enabled if the block has at least one radio button clicked yes
+3
A:
First you are using the same id
for all the buttons on the page, which is a no-no. Each id
needs to be unique. Use a class .make_requests
on the buttons.
Then try this out:
$("input:radio").change(function() {
var wrap = $(this).parents('.accordionContent');
var button = wrap.find('.make_requests');
if (wrap.find('input[type=radio][value=yes]:checked').length) {
button.removeAttr('disabled');
} else {
button.attr('disabled', true);
}
});
PetersenDidIt
2010-10-31 20:51:09