jQuery UI自动完成奇怪的行为 [英] jQuery UI autocomplete strange behavior

查看:322
本文介绍了jQuery UI自动完成奇怪的行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是我的代码:

  var availableTags = [ActionScript,AppleScript,Asp,BASIC ,C,C ++,
Clojure,COBOL,ColdFusion,Erlang,Fortran,Groovy,Haskell,
Java, JavaScript,Lisp,Perl,PHP,Python,Ruby,Scala,Scheme];

$(#City)。autocomplete({
source:availableTags
});

来自

  $(#City) .autocomplete({
来源:availableTags,
留言:{
noResults:'',
结果:function(){}
}
}) ;


Following is my code:

var availableTags = ["ActionScript", "AppleScript", "Asp", "BASIC", "C", "C++",
"Clojure", "COBOL", "ColdFusion", "Erlang", "Fortran", "Groovy", "Haskell",
"Java", "JavaScript", "Lisp", "Perl", "PHP", "Python", "Ruby", "Scala", "Scheme"];

$("#City").autocomplete({
        source: availableTags
});

From Docs, the default behavior is a kind of dropdown the matched items. But for me it is showing like

Screenshot:

10 results are available, use up and down arrow keys to navigate.

Sorry, I couldn't reproduce this behavior in jsfiddle. The navigation is done using up and down arrow keys. I don't want this, how can I revert back to default dropdown? Please share your suggestions.

Updates:

With @Anton reference, I was able to remove the validation message, however the dropdown is not showing. But I am able to navigate using up/down arrow keys. Any feedback on this?

解决方案

Try this according to this answer on SO

$("#City").autocomplete({
    source: availableTags,
    messages: {
        noResults: '',
        results: function() {}
    }
});

这篇关于jQuery UI自动完成奇怪的行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆