HTML datalist tag

HTML datalist tag

Editorial Team
Editorial Team

Follow us on Discord or Telegram to get access to free tutorials and updates.

The HTML datalist tag is used to create a list of pre-defined options for an <input> element. This tag can be used to provide auto-completion feature for input elements.

This element has only global attributes.


<datalist id="id">
    <option value="option 1">
    <option value="option 2">
    <option value="option n">


<label for="lang">Select a language</label>
<input list="languages" id="lang" name="txtlang" />
<datalist id="languages">
    <option value="C">
    <option value="C++">
    <option value="C#">
    <option value="Java">
    <option value="PHP">