We don’t allow questions seeking recommendations for software libraries, tutorials, tools, books, or other off-site resources. You can edit the question so it can be answered with facts and citations.
Closed 9 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(4)
如果您引用 jQueryUI(与 jQuery 相同的网站),您可以使用以下内容进行自动完成: http://jqueryui.com /demos/autocomplete/
这也是一个简单的实现:)
希望有帮助!
If you reference jQueryUI (same website as jQuery) you can use the following for auto complete: http://jqueryui.com/demos/autocomplete/
It's a simple implementation as well :)
Hope that helps!
这可能看起来像一个黑客,但您可以尝试向用户模仿他正在文本区域中输入,而他实际上是在文本输入中输入,该文本输入位于文本区域中下一个单词的位置。自动完成的建议或点击此覆盖文本输入中的 Enter 或空格,您可以删除文本输入,并将文本输入中的当前单词附加到文本区域。
对于文本输入中的自动完成,您可以使用大量可用于 jquery 的插件中的插件。
This might look like a hack, but you can try imitating to the user that he is typing in the textarea, whereas he would actually be typing in the textinput which is at the position for the next word in a textarea.Once the user selects a suggestion from autocomplete or hits enter or space inside this overlaid textinput, you can remove the text-input with the current word inside the textinput appended to the textarea.
For an autocomplete in text-input you can use on plugin from the plethora of plugins available for jquery.
您可以尝试 gcomplete 使用 google api 自动完成任何内容,只需稍加修改即可在源代码中,您可以更改标签
input[text]
的行为。我对插件进行了更改并自动完成最后一个单词,您可以在 github.com/rkmax/gcomplete。
我正在研究:
- 自动完成当前单词。
- 确定行数(视觉)和文本区域当前光标位置以显示光标旁边的单词列表,这要归功于 SimpleCoder
you can try gcomplete uses the google api for autocomplete anything, with a little modification to the source code, you can change the behavior about the tag
input[text]
.i made changes for the plugin and autocomplete the last word, you can test in github.com/rkmax/gcomplete.
I'm working on:
- Autocomplete the current word.
- Determine the number of lines (visual) and Textarea the current cursor position to display the list of words right next to the cursor, thanks to SimpleCoder
那么,如果您想从数据库中提取数据,有一个 自动完成插件 可以做到这一点我建议使用 jQuery 中包含的 ajax API。
类似这样的东西
还要记住,这只是给您一个想法的基本结构。
PS我刚刚发现这个它应该满足您的所有需求。
Well there is the autocomplete plugin that does just that, and if you want to pull data from a database I recomment using the ajax API that is included in jQuery.
something like this
Also remember this is just the basic structure to give you an idea.
P.S. I just found this it should fill all your needs.