How do I disable a jqueryui button
When I click on a jquery ui button, it still triggers the click event callback. How do I block t开发者_JAVA技巧hat event? Do I have to manually keep track of the state or does jquery ui take care of that for me?
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");
It's actually:
$("#btn").button({"disabled":true});
精彩评论