HTML datalist - how to use <datalist> tag

The HTML <datalist> tag defines pre-defined options for an input element which can be used to provide suggestions for the autocomplete feature. Users will see a dropdown for the suggestions. The <input> tag's list attribute is used with the <datalist> tag.


The datalist tag supports the global and event attributes.


<div> <input list="country"> <datalist id="country"> <option value="USA"> <option value="Korea"> <option value="Australia"> <option value="China"> <option value="India"> </datalist> </div>