HTML <input> list Attribute

❮ HTML <input> tag

Example

<label for="text">Choose your fav fruit:</label>
<input list="fruits" name="fruit" id="text"/>

<datalist id="fruits">
  <option>apple</option>
  <option>banana</option>
  <option>mango</option>
  <option>orange</option>
  <option>blueberry</option>
</datalist>

Meaning

The list attribute is used to set the id of a datalist element used to provide a predefined list of options suggested to the user for entry.

The <datalist> provides a list of predefined values to suggest to the user for this input.


Standard Syntax

HTML: <input list="datalistId">

XHTML: <input list="datalistId"/>



Browser Support




Status







Attribute Values

Value Description
datalistId Specifies the id of the datalist to provides a list of predefined values to the <input> element.
❮ HTML <input> tag