简体   繁体   English

Bootstrap Autocomplite插件

[英]Bootstrap Autocomplite plugins

I'm trying to find some Bootstrap Autocomplete plugin, to make autocomplete by cities. 我正在尝试找到一些Bootstrap自动完成插件,以按城市进行自动完成。 For exemple I have such arrow: 例如,我有这样的箭头:

 {
   ['Alabama','USA'],
   ['Alaska','USA'],
   ['London','UK'],
   ['Kiev','Ukraine'],
 }

and make searching by first letters of city string(country don't take). 并按城市字符串的首字母进行搜索(国家不接受)。 The most nice plugin that I've found: https://twitter.github.io/typeahead.js/examples/ 我找到的最漂亮的插件: https : //twitter.github.io/typeahead.js/examples/

But in it searching goes by all entered symbols. 但是在其中搜索按所有输入的符号进行。

So: 所以:

  • i'm looking for autocomplete by name of city by first symbols, and shows with country; 我正在通过第一个符号按城市名称查找自动填充,并显示国家/地区;

  • if I wrote "Al", select box must show: 如果我写了“ Al”,则选择框必须显示:

Al abama, USA ABAMA,USA

Al aska, USA ASKA,USA

with highlited "Al". 高亮显示“ Al”。


Maybe will be good idea change arrow to strings like: 将箭头更改为类似字符串的字符串可能是个好主意:

['Alabama, USA', 'Alaska, USA', 'London, UK','Kiev, Ukraine']

?

I think what you are looking for is select2 : https://select2.github.io/ 我认为您正在寻找的是select2: https ://select2.github.io/

You can check out the example here : https://select2.github.io/examples.html 您可以在此处查看示例: https : //select2.github.io/examples.html

You may also want to arrange your array to something like this: 您可能还想将数组安排为以下形式:

{
  ['Alabama, USA'],
  ['Alaska, USA'],
  ['London, UK']
}

I have been using MagicSuggest pluggin since years. 多年来,我一直在使用MagicSuggest插件。 Very easy to manage, it will provides you auto suggestion and auto select too.Plenty of options are available. 它非常易于管理,它将为您提供自动建议和自动选择。

Please have a look at MagicSuggest demo . 请看一下MagicSuggest演示

For documentation see here 有关文档, 请参见此处

Have a look on sample codes 看一下示例代码

To download please go to GitHub 要下载,请转到GitHub

As per my understanding it might help you. 根据我的理解,它可能会对您有所帮助。 If you found any difficulties feel free to ask. 如果发现任何困难,请随时询问。

Thanks 谢谢

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM