jQuery - 自动建议/完成?
我正在为自动完成/自动建议 jQuery 插件寻找一个好的解决方案。我发现的那些在选择值后会停止自动完成/建议。我正在尝试模仿 Google Suggest。
例如,假设我提供以下选项:
- aaa
- bbb
- ccc
当用户输入 a
时,应向用户显示 aaa
。如果用户选择该选项,然后按空格(意味着用户准备输入更多内容),我希望用户在他/她时仍然可以使用 bbb
和 ccc
正在打字。
对我可以使用的东西有什么建议吗?
(注意:也许 Google Suggest 的行为实际上与可用插件相同。也许它的选项列表只包含用户可能输入的所有可能的排列。)
I'm looking for a good solution for an autocomplete/autosuggest jQuery plugin. The ones I have found stops auto-completing/suggesting after a value is selected. I'm trying to mimic Google Suggest.
For example, say I provide the following options:
- aaa
- bbb
- ccc
When user type in a
, the user should be presented with aaa
. If user selects that, then presses a space (meaning, user is getting ready to type some more), I want bbb
and ccc
still available to the user when he/she is typing.
Any suggestions for what I might be able to use?
(NOTE: Perhaps Google Suggest actually behaves the same way as the available plugins. Perhaps its list of options just contain every possible permutation of what the user might type.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,我认为谷歌拥有所有可能的排列是正确的。
我建议保留标准 jquery 自动完成插件(http://docs.jquery.com/Plugins/autocomplete)。
Yeah, I think your right about google having every possible permutation.
I would suggest keeping with the standard jquery autocomplete plugin (http://docs.jquery.com/Plugins/autocomplete).
你可以试试这个:
nicolasbize.github.com/magicsuggest
您将通过以下代码获得所需的行为:
免责声明:我是作者
You can try this one:
nicolasbize.github.com/magicsuggest
You will get the desired behaviour with the following code:
disclaimer: i am the author