HTML Dog
Skip to navigation

HTML Tag: datalist

A list of options for use by form controls. It can be associated with an input element, and contain options defined by option elements. A text field can thereby be extended to have an additional list of user-selectable options.

The list attribute on an input element will associate the form field to a datalist that has a matching id attribute.

Optional Attributes

Global attributes

Example


<form action="/residence/">
    <label>Country of residence:
        <input name="country" list="countries">
        <datalist id="countries">
            <option>India</option>
            <option>UK</option>
            <option>USA</option>
        </datalist>
    </label>
    <input type="submit">
</form>