Skip to main content

html-tags.com

<datalist>

Native autocomplete suggestions for an input — suggestions, not restrictions.

Baseline: Widely available · Forms

When to use it

Link it from an input's list attribute; users can pick a suggestion or type anything else.

When not to

If the value must come from the set, that's a select, not a datalist.

Key attributes

id
referenced by input list='…'

Example

<label for='topic'>Favorite element</label>
<input type='text' id='topic' name='topic' list='elements'>
<datalist id='elements'>
  <option value='hgroup'></option>
  <option value='output'></option>
</datalist>
Rendered live above, source below.

Authoritative references