To create an input field that has a related dropdown list, you need to:
- Create a
<datalist>element with anid, and a set of<option>elements that represent options to choose from; - Create an
<input />element with thelistattribute that matches theidof the<datalist>element.
For example:
<input type="text" list="countryName" placeholder="Country Name" />
<datalist id="countryName">
<option value="Germany">
<option value="United Kingdom">
<option value="United States of America">
<!-- ... -->
</datalist>