O'Reilly logo

Instant typeahead.js by Toby Osbourn

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Basic searching (Must know)

You might be glad to know that we are leaving the command line behind us now and will be diving into code!

In this recipe we will cover the most basic example using typeahead.js. This will be the recipe that all further recipes will be built from and while it won't let you appreciate the full power of typeahead.js, it will give you a taste of what is in store.

Our scenario is: we want to help a user choose from a predefined list of their friends, which we know ahead of time. We could give them a dropdown list, but we don't know how long this list could get, and we know that on mobile devices, very long dropdown lists can annoy the user.

Getting ready

In order to complete this recipe we need a few things:

  • For typeahead.js ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required