我怎么能对一个文本框添加多个项目的自动完成功能? [英] How can I add a multiple-item autocompletion functionality for a textbox?
问题描述
我想有一个文本框,如果我写了一些东西,它会为我提供线索。
就像我写的林斯顿
在城市的文本字段,它会显示伦敦
,如果我点击它,一用具有小十字小盒子伦敦
应该被添加到该文本字段。然后,我可以重复这种添加更多的项目。
I want to have a textbox, and if I write some thing in it, it will provide me hints.
Like I write Lond
in a "cities" text field, it will display London
and if I click on it, a small box with a small cross having London
should be added to the text field. Then I can repeat this to add more items.
这就像在堆栈溢出标记编辑控件相同的功能:如果我写标记名称,它将自动搜索,当我点击,它被添加
It's the same functionality like in Stack Overflow tag edit control: If I write a tag name, it automatically searches and when I click, it is added.
我想这是一些jQuery组件 - 哪一个呢?
I suppose it's some jQuery component - which one?
推荐答案
或者,你可以使用这个插件:
http://loopj.com/jquery-tokeninput/
Or, you could use this plugin: http://loopj.com/jquery-tokeninput/
在这里,你有一个演示:
http://loopj.com/jquery-tokeninput/demo.html
Here you have a demo: http://loopj.com/jquery-tokeninput/demo.html
希望这有助于。干杯
这篇关于我怎么能对一个文本框添加多个项目的自动完成功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!