The disabled attribute is a boolean attribute. When present, it specifies that the button should be disabled. A disabled button is unusable and un-clickable. The disabled attribute can be set to keep a user from clicking on the button until some other condition has been met (like selecting a checkbox, etc.).
You can initially configure the Button as disabled either through its enable property or by initializing it from an element which has a disabled="disabled" HTML attribute. The Button can also be disabled or enabled at any time with JavaScript by using its enable() method with a Boolean argument.
To make the disabled button, we will use the Pure CSS class “pure-button-disabled” with the class “pure-button”. We can also create a disabled button using disabled attribute. Disabled Button used Class: pure-button-disabled: It is used to disable the Pure CSS button.
Try this.
$('#button_id').button("disable");
$('#button_id').button("enable");
It works for me:
$("#button_id").attr("disabled", true).addClass("ui-state-disabled");
according the documentation:
// setter
$( "#button_id" ).button( "option", "disabled", true );
If you define like this:
$("#mybtn").button();
you must enable/disable like this:
$("#mybtn").button("enable");
// OR
$("#mybtn").button("disable");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With