Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to setup a textarea with auto suggest from Dictionary

Tags:

javascript

This Question is bit broad, I did enough research and asking here so that I can get at least some suggestions.

I am trying to set up auto complete textbox/textarea dictionary suggestions. I have tried to setup auto-complete from JSON data from server and I am able to do that.. But here my question is, Can I set up a textarea with auto suggest from dictionary words like when we are entering some text in Word processor. Is it possible through any API available?

like image 750
Exception Avatar asked Jan 29 '13 04:01

Exception


3 Answers

You could try Google Places Autocomplete API. Here's some related SO thread. I can't find any official documentation to the Google Search Autocomplete API, thankfully someone already did the research for us. Follow instructions there, it shouldn't be too difficult to set-up (looks rather straight forward with both JSON and XML notated responses).

like image 198
Wanka-Wah-Wah Avatar answered Nov 07 '22 20:11

Wanka-Wah-Wah


I am sure you would have find many ways to achieve autocomplete on TextArea. To name a few

  • http://jqueryui.com/autocomplete/
  • http://textextjs.com/

Both the framework and function are rich enough.

Coming on the dictionary API's

  • http://www.google.com/dictionary/json?callback=dict_api.callbacks.id100&q=Sweet&sl=en&tl=en Undocumented API of google, returns JSONP

API page for altervista

  • http://thesaurus.altervista.org/testjs

Few others are

  • http://words.bighugelabs.com/api.php
  • http://developer.dictionary.com/products
  • https://webster.cs.washington.edu/cse154/labs/ajax/urban.php?term=india
  • http://www.wordreference.com/docs/api.aspx
like image 44
Manish Singh Avatar answered Nov 07 '22 18:11

Manish Singh


Well, if you do have access to a JSON response from some server, you could use jQuery. http://jqueryui.com/autocomplete/

$(function() {
  function log( message ) {
    $( "<div>" ).text( message ).prependTo( "#log" );
    $( "#log" ).scrollTop( 0 );
  }

  $( "#birds" ).autocomplete({
    source: "search.php",
    minLength: 2,
    select: function( event, ui ) {
      log( ui.item ?
        "Selected: " + ui.item.value + " aka " + ui.item.id :
        "Nothing selected, input was " + this.value );
    }
  });
});
like image 2
martriay Avatar answered Nov 07 '22 18:11

martriay