HTML datalist tag

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

HTML datalist tag

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.

Syntax

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

Example

<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">
</datalist>

Output


Share Tweet Send
0 Comments
Loading...