The autocomplete () Method

The autocomplete () method can be used in two forms:

  • $(selector, context).autocomplete (options)

  • $(selector, context).autocomplete ("action", params)

The autocomplete (options) Method

The autocomplete (options) method declares that an <input> HTML element must be managed as an input field that will be displayed above a list of suggestions. The options parameter specifies the behavior of the list of suggestions when the user is typing in the input field.

The operation of autocompletion is as follows: from the characters introduced in the input field, a match is made in the specified source (in options.source). Matching can be done with any character from the source, not just the beginning of it. Thus, if one looks for the letter “a,” it does not have to be located at the beginning of words, but can be located in the middle.

Managing autocompletion

Table 9-1 details the options that are available for managing autocompletion.

Table 9-1. Options for managing autocompletion




When set to true, disables the autocompletion mechanism. Users can enter characters into the text field, but no list appears. Use autocomplete ("enable") to enable the autocompletion mechanism.


Indicates the data source to use for the list of suggestions. Data can be local (already known in the program) or remote (retrieved from the server).


Minimum number of characters to enter in the field to start the display of the list of suggestions. ...

Get jQuery UI now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.