开发者

How do I disable a jqueryui button

开发者 https://www.devze.com 2023-01-16 10:11 出处:网络
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 t

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

精彩评论

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