On the modern web, events do not happen in isolation and, as developers, we want to be able to get our hooks into events at various stages. Luckily for us, typeahead.js offers plenty of scope for creating custom events and I will be discussing them in this section.
In order to show this functionality we can build on an existing example. I will use the third recipe, Preloading JSON (Should know). If we load up these files in our editors, we will be specifically adding to
We want to hook into jQuery's
.on functionality, which listens for events being triggered. We will call one for each of the publicly accessible events that are currently supported by typeahead.js.