jqueryui组合框: how do I get the value?

标签 jquery jquery-ui combobox

我借用了http://jqueryui.com/demos/autocomplete/#combobox的代码但不知道如何获取所选项目的值。

希望得到一个简单直接的答案,而不是在接下来的 2 小时内阅读他们的文档。

最佳答案

$('#combobox').val() might do the trick

好吧,这不正确。这样做:

$( "#combobox" ).autocomplete({
   select: function(event, ui) { ... }
});

在那里做一个console.log($(ui).val())或类似的东西

那么你应该能够执行以下任一操作: $('#combobox').text() 或 .val() 获取其内容。

关于jqueryui组合框: how do I get the value?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9353864/

相关文章:

javascript - 将元素拖动到可排序后切换停止工作

c# - 自定义 ComboBox 样式看不到所选项目文本

javascript - 如何使用 js 更改 jquery slider 值

javascript - 如何使用 jquery 增加文本框的值?

javascript - jQuery 1.11.3 : Insert a div of "Tasks" based on the order of their categories

javascript - jquery(a)同步请求等待

jQueryUI 可删除 : over and out callback firing out of sequence

javascript - JQuery UI 对话框可以记住它在打开和关闭之间的位置吗

java - 按钮在右侧对齐不正确,并且右侧组件的尺寸太大

python - 如何修改ttk Combobox字体?