如何禁用 jQuery UI 组合框?

How do you disable a jQuery UI Combobox?

我正在尝试禁用我创建的 jQuery UI 组合框。我已经搜索过了,但还没有找到任何有用的东西。

这是一些 JSFiddle:

...
$(function() {
    $( "#userInfo" ).combobox();
    $( ".custom-combobox-input").attr("placeholder", "(Pay Band GS 1-15/rank)");
    $( "#userInfo input" ).attr('disabled', true);
    $( "#userInfo button" ).attr('disabled', true);
});

我已经编程并尝试了我在 ComboBox disable:

找到的最佳答案
...
$("#box3").combobox(); // init autocomplete combobox 3

// set initial state of generated combobox 2
$("#test2 input").attr('disabled',true);
$("#test2 button").attr('disabled',true);  

// set initial state of generated combobox 3
$("#test3 input").attr('disabled',true);
$("#test3 button").attr('disabled',true);  

。看起来它正朝着正确的方向前进。我能够禁用他们的 "box1",但似乎无法用我的禁用。然而,我的 combobox() 开始时间稍晚,为 jQuery 11。但这可能与它无关。

虽然这在技术上不能回答您的具体问题,但我强烈建议您花一点时间学习 "Chosen." 它是一个 JQuery 插件,可以满足您的大部分需求。最重要的是,学习 JQuery 插件总是一个好主意。还有很多其他好的。