Working with autocomplete events
The autocomplete widget exposes a range of unique events that allow us to react programmatically to the widget being interacted with. These events are listed as follows:
Event |
Fired when... |
---|---|
|
A suggestion from the list is selected. This event is fired once the list has closed and the |
|
The suggestion list is closed. |
|
An instance of the widget is created. |
|
The keyboard is used to focus a suggestion in the list. |
|
The suggestion menu is displayed. |
|
The request for the suggestions is about to be made. |
|
A suggestion from the list is selected. |
The select
event is useful when we are working with an array of objects as the data source and have additional data other than the label
and value
properties that we used earlier. For the next example, remove the <div>
container that we used in the last example and then change the configuration object, so that it appears...