开发者

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});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜