By giving an Autocomplete field focus or entering something into it, the plugin starts searching for entries that match and displays a list of values to choose from. By entering more characters, the user can filter down the list to better matches.
This can be used to choose previously selected values, such as entering tags for articles or entering email addresses from an address book. Autocomplete can also be used to populate associated information, such as entering a city name and getting the zip code.
You can pull data in from a local or remote source: Local is good for small data sets, e.g., an address book with 50 entries; remote is necessary for big data sets, such as a database with hundreds or millions of entries to select from. To find out more about customizing the data soure, see the documentation for the source
option.
When the menu is open, the following key commands are available:
When the menu is closed, the following key commands are available:
minLength
has been met.null
.close
event will be accompanied by a change
event.Canceling this event prevents the value from being updated, but does not prevent the menu item from being focused.
source
option callback is not required. This event is always triggered when a search completes, even if the menu will not be shown because there are no results or the Autocomplete is disabled.value
and label
properties for each item.minLength
and delay
are met. If canceled, then no request will be started and no items suggested.Canceling this event prevents the value from being updated, but does not prevent the menu from closing.
search
method, to close the open menu.search
event and invokes the data source if the event is not canceled. Can be used by a selectbox-like button to open the suggestions when clicked. When invoked with no parameters, the current input's value is used. Can be called with an empty string and minLength: 0
to display all items.jQuery
object containing the menu element. Although the menu items are constantly created and destroyed, the menu element itself is created during initialization and is constantly reused.
Select a programming language:
]]>