jQuery plugin that suggests/autocompletes within a textarea [closed]

こ雲淡風輕ζ 提交于 2019-12-02 18:33:52
Breezer

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

$('textarea').keyup(function(){
  $.post('ajax/test.php', function(data) {
   $('#example').autocomplete(data);

   });

});

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.

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!

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.

rkmax

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!