@mentions 和 #tags 的文本区域自动建议
我正在使用 Rails 3.2 应用程序,我需要为文本区域提供自动建议,以在同一文本区域中获取 @mentions 用户和 #tags。
详细说明: 当用户开始输入@ab时...自动建议应该从提供的json中获取用户,当他输入#ab时,它应该建议我提供的json中的标签。如果输入的字母没有标签,则应自动添加新标签到建议列表并在单击操作时附加到文本区域。
请建议一些 jquery 选项来在文本区域中启用此功能
I am working in a rails 3.2 application and i have a requirement to provide auto-suggest for a text area to fetch @mentions users and #tags in the same textarea.
To elaborate:
when a user starts typing @ab... the autosuggest should fetch users fron json is provide and when he types #ab it should suggest tags from json i provide.If there are no tags for the letters entered the new tag should automatically get added to the suggest list and get appended to the textarea on click action.
Please suggest some jquery option to enable thi feature in a textarea
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这是我们刚刚开源的另一个:jquery-sew
Here is another we just open sourced: jquery-sew
你一定会喜欢这个的。这是您需要的库
http://podio.github.io/jquery-mentions-input/
You will love this one. this is your required library
http://podio.github.io/jquery-mentions-input/
这里列出了很多不错的选项: jQuery 自动完成标记插件- 像 StackOverflow 的输入标签一样?
其中,我推荐 tag-it 插件 ( http://aehlke.github.com/tag-it/ )。配置其自动建议来执行您想要的操作应该非常简单。
附带说明一下,您的大多数选项可能会使用
而不是
无耻的插件:实际上,我一直在尝试将 jQuery 标签编辑器插件与自动建议组合在一起,如果您需要调整任何内容,代码非常简单: https://github.com/donmccurdy/input-tokenizer
There are quite a few good options listed here: jQuery autocomplete tagging plug-in like StackOverflow's input tags?
Of those, I'd recommend the tag-it plugin ( http://aehlke.github.com/tag-it/ ). It should be pretty simple to configure its autosuggest to do what you want.
As a side note, most of your options are probably going to use
<div>
instead of<textarea>
tags, since textareas are really intended just for text.Shameless plug: I've been trying to put together a jQuery tag-editor plugin with autosuggest myself, actually, and the code is pretty straightforward if you need to tweak anything: https://github.com/donmccurdy/input-tokenizer