jQuery 自动完成标记插件像 StackOverflow 的输入标签一样吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/519107/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
jQuery autocomplete tagging plug-in like StackOverflow's input tags?
提问by Joe Phillips
What solutions accomplish the same auto-completion that SO uses for entering tags?
哪些解决方案可以实现 SO 用于输入标签的相同自动完成?
There are plugins that can handle one word but I haven't seen any that handle multiple words.
有可以处理一个单词的插件,但我还没有看到可以处理多个单词的插件。
回答by Dmitriy Nesteryuk
In order of activity, demos/examples available, and simplicity:
按照活动、演示/示例和简单性的顺序:
- (demo) https://github.com/yairEO/tagify
- (demo) https://github.com/aehlke/tag-it
- (demo) http://ioncache.github.com/Tag-Handler/
- (demo) http://textextjs.com/
- (demo) https://github.com/webworka/Tagedit
- (demo) https://github.com/documentcloud/visualsearch/
- (demo) http://harvesthq.github.io/chosen/(this isn't really a tagging plugin)
- (demo?) http://bootstrap-tagsinput.github.io/bootstrap-tagsinput/examples/
- (demo?) http://jcesar.artelogico.com/jquery-tagselector/
- (demo?) http://remysharp.com/wp-content/uploads/2007/12/tagging.php
- (demo?) http://pietschsoft.com/post/2011/09/09/Tag-Editor-Field-using-jQuery-similar-to-StackOverflow.aspx
- (演示) https://github.com/yairEO/tagify
- (演示) https://github.com/aehlke/tag-it
- (演示) http://ioncache.github.com/Tag-Handler/
- (演示) http://textextjs.com/
- (演示) https://github.com/webworka/Tagedit
- (演示)https://github.com/documentcloud/visualsearch/
- (演示)http://harvesthq.github.io/chosen/(这不是真正的标记插件)
- (演示?)http://bootstrap-tagsinput.github.io/bootstrap-tagsinput/examples/
- (演示?)http://jcesar.artelogico.com/jquery-tagselector/
- (演示?)http://remysharp.com/wp-content/uploads/2007/12/tagging.php
- (演示?)http://pietschsoft.com/post/2011/09/09/Tag-Editor-Field-using-jQuery-similar-to-StackOverflow.aspx
Related:
有关的:
回答by Nishant
Bootstrap:If you are using Bootstrap. This is a really good one: Select2
Bootstrap:如果您使用的是 Bootstrap。这是一个非常好的选择:Select2
Also, TokenInputis an interesting one. First, it does not depend on jQuery-UI, second its config is very smooth.
此外,TokenInput是一个有趣的输入。首先,它不依赖于 jQuery-UI,其次它的配置非常流畅。
The only issue I had it does not support free-tagging natively. So, I have to return the query-string back to client as a part of response JSON.
我遇到的唯一问题是本机不支持自由标记。因此,我必须将查询字符串作为响应 JSON 的一部分返回给客户端。
As @culithay mentioned in the comment, TokenInput supports a lot of features to customize. And highlight of some feature that the others don't have:
正如@culithay 在评论中提到的,TokenInput 支持很多特性来自定义。并突出一些其他人没有的功能:
- tokenLimit: The maximum number of results allowed to be selected by the user. Use null to allow unlimited selections
- minChars: The minimum number of characters the user must enter before a search is performed.
- queryParam: The name of the query param which you expect to contain the search term on the server-side
- tokenLimit:允许用户选择的最大结果数。使用 null 允许无限制的选择
- minChars:执行搜索前用户必须输入的最少字符数。
- queryParam:您希望在服务器端包含搜索词的查询参数的名称
Thanks culithay for the input.
感谢 culitay 的输入。
回答by Julian
This originally answered a supplemental question about the wisdom of downloading jQuery versus accessing it via a CDN, which is no longer present...
这最初回答了一个关于下载 jQuery 与通过 CDN 访问它的智慧的补充问题,该问题不再存在......
To answer the thing about Google. I have moved over to accessing JQuery and most other of these sorts of libraries via the corresponding CDN in my sites.
回答关于谷歌的事情。我已经转而通过我站点中的相应 CDN 访问 JQuery 和大多数其他此类库。
As more people do this means that it's more likely to be cached on user's machines, so my vote goes for good idea.
随着越来越多的人这样做意味着它更有可能被缓存在用户的机器上,所以我投票赞成好主意。
In the five years since I first offered this, it has become common wisdom.
自从我第一次提出这个问题以来的五年里,它已经成为普遍的智慧。
回答by Mrchief
Another excellent plugin: http://documentcloud.github.com/visualsearch/
另一个优秀的插件:http: //documentcloud.github.com/visualsearch/
回答by boreq
Check this plugin:
检查这个插件:
How to use AJAX for loading the tags https://stackoverflow.com/a/7662534/1078027
如何使用 AJAX 加载标签https://stackoverflow.com/a/7662534/1078027
回答by user1880508
We just open-sourced this jquery plug-in Github: tactivos/jquery-sew.
我们刚刚在Github 上开源了这个 jquery 插件:tactivos/jquery-sew。