我正在创建一个小部件,单击按钮后我希望禁用该小部件。
(function ($) {
$.widget("df.txt", { })
})(jQuery);
$(document).ready(function () {
//register input widgets
$("input").txt({ disabled: true });
//Register button to disable/enable inputs
$("button").click(function () {
//$("input").txt("disable");
$("input").txt("option", "disabled", true);
});
});
我正在使用这个link作为引用。
它不起作用,有什么帮助吗?
最佳答案
试试这个
$('input').attr("disabled", true);
or
$('input').attr("disabled", 'disabled');
这里我们将属性disabled设置为true。
关于jquery - UI 小部件禁用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15496782/