Unified Astronomy Thesaurus Autocomplete Widget


Single Word Autocomplete Example

This version of the autocomplete allows the user to type a few letters and see all matching words from the UAT.



Enabling the autocomplete is easy. Just use jquery to select the input or textarea element you want to enable with the autocomplete, and use the uatAutocomplete function: $("#uat-autocomplete-single").uatAutocomplete()


Multi Word Autocomplete Example

This version of the autocomplete allows the user to select multiple, comma-separated phrases.



To enable multiple selection, pass {"multi" : true} to the options, like so: $("#uat-autocomplete-multi").uatAutocomplete({ multi: true })


Steps to enable autocomplete:

  1. Make sure to include the jquery, jquery ui, jquery ui css, and finally the uat_autocomplete files on your page. (Take a look at this page's source for a look at how this demo is including those files).
  2. Select your input or textarea element and call uatAutocomplete as shown above.
  3. Right now, the autocomplete begins working after the user enters in three letters. If you'd like to change this, do so like this: (here we are changing the autocomplete to activate after a single character is entered) $("#uat-autocomplete-multi").uatAutocomplete({minLength:1})
  4. This widget is a simple extension of the jquery ui autocomplete widget. You can use any of that widget's methods on the uatAutocomplete widget. Full documentation can be found here.