我正在使用 jQuery 的 AutoComplete 插件在网页上创建自动完成功能。
有谁知道如何让列表显示,例如,如果有人输入了 3 个字符,然后单击了输入框,然后又返回到它?
$("#details_business_trade").autocomplete({
source: resultsSplit,
autoFill: true,
mustMatch: true,
close: function() { $("#createProspect").validate().element("#details_business_trade"); },
mustMatch: true
});
这是我到目前为止的代码...
最佳答案
当使用 search
method 重新聚焦时,您可以使用当前值触发搜索。 ,像这样:
$("#details_business_trade").autocomplete({
source: resultsSplit,
autoFill: true,
mustMatch: true,
close: function() { $("#createProspect").validate().element("#details_business_trade"); },
mustMatch: true
}).focus(function() {
$(this).autocomplete("search");
});
这不是你的例子,but here's a jQuery UI Demo updated with the same concept ,例如搜索“act”。
关于jQuery 自动完成 - 双击显示列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3856661/