I can disable it fine using this:
button.attr('disabled', 'disabled' ).addClass( 'ui-state-disabled' );
But how do I re-enable it? When I use this:
button.attr('enabled', 'enabled' ).addClass( 'ui-state-enabled' );
It doesn't work.
I can disable it fine using this:
button.attr('disabled', 'disabled' ).addClass( 'ui-state-disabled' );
But how do I re-enable it? When I use this:
button.attr('enabled', 'enabled' ).addClass( 'ui-state-enabled' );
It doesn't work.
button.removeAttr('disabled').removeClass( 'ui-state-disabled' );
Tried all the answers here and nothing worked for me.
The issue is that I have html:
<input type="submit" value="Save" id="saveButton" disabled="disabled" />
Then I call globaly:
$("button, input:submit, input:button").button();
After that the button gets attribute aria-disabled=true.
Neither of following will enable the submit:
$("#saveButton").attr('disabled',false);
$("#saveButton").removeAttr('disabled');
$("#saveButton").prop('disabled',false);
$("#saveButton").attr('aria-disabled',false);
$("#saveButton").removeClass('ui-state-disabled' );
The only working solution in this case is:
$("#saveButton").button( "enable" );
jQuery UI Docs: Button Widget - enable()
To disable button again:
$("#saveButton").button( "disable" );
jQuery UI Docs: Button Widget - disable()
With jquery you can use removeAttr and removeClass to get rid of your disabled attribute/class:
button.removeAttr('disabled').removeClass('ui-state-disabled');
I think that this is what are you looking for:
button.removeAttr("disabled");