← Back to all elements

The <datalist> Element

The <datalist> element contains a set of <option> elements that represent the permissible or recommended options available to choose from within other controls.

When to use it

Use the <datalist> element to provide an 'autocomplete' feature on <input> elements. It provides a list of predefined options to the user as they type, which is a great user experience for forms with many possible values.

The user can select from the suggestions, or type in their own value if it's not on the list. It's more flexible than a <select> element in that way.

Live Demo & Code