【发布时间】:2013-05-10 12:44:25
【问题描述】:
我正在将我的应用程序迁移到 twitter-bootstrap,并且我想用 typeahead.js 替换我的 jquery-ui 自动完成功能。
最好使用嵌入在 twitter-bootstrap 中的功能,但如果需要,我可以使用额外的 typeahead 插件。
我的问题是我无法重现当前行为,尤其是在没有结果的情况下。
你会怎么做这样的事情?
$("#search").autocomplete({
source : myUrl,
delay : 100,
minLength : 2,
select : function(event, ui) {
// do whatever i want with the selected item
},
response : function(event, ui) {
if (ui.content.length === 0) {
ui.content.push({
label : "No result",
value : customValue
});
}
}
});
基本上,如果没有结果,我想在组件中显示一条自定义消息。
谢谢!
【问题讨论】:
-
你有没有看到这个问题:stackoverflow.com/q/9232748/497356?
标签: jquery-ui twitter-bootstrap bootstrap-typeahead typeahead.js