HTML <input> listAttribute

HTML input 标签参考手册HTML <input> Tag

Examples

An <input> element with predefined values from the <datalist>:

<input list="browsers">

<datalist id="browsers">
  <option value="Internet Explorer">
  <option value="Firefox">
  <option value="Google Chrome">
  <option value="Opera">
  <option value="Safari">
</datalist>

Try it Yourself »

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Internet Explorer 10, Firefox, Opera, and Chrome support the list attribute.

Note:Safari or Internet Explorer 9 and earlier versions do not support the list attribute of the <input> tag.


Definition and Usage

The list attribute references<datalist>element, which contains predefined options for the <input> element.


Differences between HTML 4.01 and HTML5

The list attribute is a new attribute in HTML5.


Syntax

<input list="datalist_id">

Attribute Values

Value Description
datalist_id Specifies the id of the datalist bound to the <input> element.


HTML input 标签参考手册HTML <input> Tag Other Extensions