Posted on

How to create an autocomplete input with plain Javascript

Now, most people who have built websites have included forms. Regular text elements, number, select (dropdown), checkboxes and radio buttons.

The problem

A situation I’ve often encountered is where we need the user to choose from a very long list of options.
The easiest thing to do is to put all the options into a select element. However, this is impractical because…

  1. It can make for a very terrible user experience
  2. If all the options are huge (like in thousands) then there is no practical reason to load all these into the select option.

A solution

An auto complete form. We could have a huge list and show only those relevant to the user. We don’t need to load all the results into the HTML, we can simply load the ones we need as the user types.

Continue reading: How to create an autocomplete input with plain Javascript


Also published on Medium.

Spread the love

There are no comments

Leave a comment... please :-)

Your email address will not be published. Required fields are marked *