可以使用 jQuery Auto Suggest 来提出类似建议的 Twitter 提及吗?
使用 Twitter,当您键入推文时,只要键入 @,它就会触发自动建议以快速输入 Twitter 句柄。您可以在推文的开头、中间和多次添加@。
jQuery AutoSuggest 可以处理这个问题吗?仔细查看后,似乎它对于仅包含自动建议值的输入字段很有用。不是多次或在不同地点。
想法?例子?谢谢
With Twitter, when you type a tweet, anytime you type @ it triggers an autosuggest to quickly enter a twitter handle. You can do @ at the beginning of a tweet in the middle and multiple times.
Can jQuery AutoSuggest handle this? After looking it over it seems like it is good for input fields that just contain the autosuggest value. Not multiple times or in various locations.
Thoughts? Examples? Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用文本区域来完成此操作,只需放置一个文本区域并将其绑定到按键事件并侦听 @charCode,然后触发 AJAX 请求以显示自动完成框。考虑以下简单的演示。
http://jsfiddle.net/Vmes9/6/
You can do it using a textarea, simply put a textarea and bind it a keypress event and listen for @ charCode then fire an AJAX request to show autocomplete box. Consider the following simple demo.
http://jsfiddle.net/Vmes9/6/
如果“jQuery AutoSuggest”您的意思是jQuery UI Autocomplete,并且如果 >“处理这个”你的意思是“作为这个实现中的一个组件”,那么是的,它可以:)。
“提及”管理实用程序有 3 个组件:
自动完成模块:负责获取和显示可用于在给定字符串的情况下创建提及的项目集的组件。
提及跟踪模块:负责跟踪提及相关数据的组件;至少应在对附加实用程序的输入元素的文本的所有修改中跟踪每个提及的位置以及表面和实质性(如果存在)值。
提及视觉区分模块:负责将提及文本与附加实用程序的输入元素中的其余文本区分开来的组件。
既然您要求提供此类实用程序的示例,请查看 Mentionator,它实际上使用 jQuery UI Autocomplete 作为其自动完成模块。 Mentionator 功能强大、结构良好、易于理解且评论丰富,因此它应该可以用作开箱即用的解决方案,也可以用作未来解决方案的参考材料。它由moi维护。
If by "jQuery AutoSuggest" you mean jQuery UI Autocomplete, and if by "handle this" you mean "serve as a component in an implementation of this", then yes, it can :).
A "mention"-management utility has 3 components:
Autocomplete module: The component responsible for procuring and displaying the set of items that can be used to create a mention, given a string.
Mention tracking module: The component responsible for keeping track of mention-associated data; at the bare minimum the location, as well as the superficial and substantive (if existent) values of each mention should be tracked throughout all modifications of the text of the input element to which the utility is affixed.
Mention visual differentiation module: The component responsible for differentiating mention text from the rest of the text in the input element to which the utility is affixed.
Since you asked for an example of such a utility, check out Mentionator, which actually uses jQuery UI Autocomplete as its autocomplete module. Mentionator is robust, well-structured, easy to follow and copiously commented, so it should be of use to as either an out-of-the box solution, or reference material for a prospective one. It is mantained by moi.