如何禁用jQuery UI组合框? [英] How to disable jquery ui combobox?
本文介绍了如何禁用jQuery UI组合框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用从此页获取的标准代码,并尝试禁用组合框:
I use standard code taken from this page and try to disable combobox:
$( "#cbCountry" ).combobox({ disabled: true });
但是它仍然启用.怎么了?
But it is still enabled. What is wrong here?
推荐答案
该代码用于初始化禁用的组合框.如果要禁用现有的组合框,请使用以下方法:
That code is for initializing a disabled combobox. If you want to disable an existing combobox, use this:
$("#cbCountry").combobox("option", "disabled", true);
更新
Combobox是一个单独的jQuery UI小部件,似乎没有实现这些选项.我可以通过在小部件中找到文本字段和按钮并禁用它们来禁用它:
Combobox is a separate jQuery UI widget, and it seems it does not implement these options. I was able to disable it by finding the text field and button inside the widget, and disabling those:
$("#cbCountry").closest(".ui-widget").find("input, button" ).prop("disabled", true)
这篇关于如何禁用jQuery UI组合框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文