jQuery用户界面自动完成 - 工具提示显示从列表中的所有entrys,甚至不匹配 [英] jQuery UI Autocomplete - tooltip is showing ALL entrys from list, even that not matching

查看:157
本文介绍了jQuery用户界面自动完成 - 工具提示显示从列表中的所有entrys,甚至不匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

自动完成泡沫正在显示出来,但是当我输入输入一些东西,工具提示显示从列表中的所有entrys,即使是不匹配......为前。我可以输入:aaaazzzz,而且还有自动完成泡沫(列表中没有这样的字符串)...有1600多用户/元素users.txt - 但即使当我减少列表5 entrys出现问题。我的脚本是:

Autocomplete bubble is showing up, but when I type something in input, tooltip is showing ALL entrys from list, even that not matching... for ex. I can type: "aaaazzzz" and still have autocomplete bubble (in list there is NO such string)... There is more than 1600 users/elements in users.txt - but problem occurs even when I reduced list to 5 entrys. My script is:

$( "#userLogin" ).autocomplete({
    source: 'users.txt'
});

users.txt:

users.txt:

["user1","user2","user3"]

相关:<一href=\"http://stackoverflow.com/questions/10682901/jquery-ui-autocomplete-get-data-from-txt-file\">jQuery UI自动完成 - 得到的txt文件数据

请指教。谢谢你。

推荐答案

jQuery也不能很好地与txt文件时,您需要首先从txt文件中的数据分解成一个数组,然后使用该数组作为源:

Jquery doesn't work well with txt files, you need to first break the data from the txt file into an array and then use that array as the source:

    var availableTags;
    $.get("Array.txt", function(data) {
        availableTags = data.split(',');
         $( "#tags" ).autocomplete({source:availableTags})
     });

这篇关于jQuery用户界面自动完成 - 工具提示显示从列表中的所有entrys,甚至不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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