Tag Description
The datalist tag is used to define a list of options. Use this element together with the input element, to define which values the input element can have. The input element's list attribute is used to bind it together with the datalist.
This tag has the form:
<datalist id="string">
option values
</datalist>
Note: The datalist and its options will not be displayed. They are only a list of legal input values.
HTML5 and HTML4.01 Differences
This tag is new for HTML5.
Global Attributes
This tag also supports the HTML Global Attributes.
Event Attributes
This tag also supports the HTML Event Attributes.
Examples
The following example shows the basic use of this tag:
<input list="cars" />
<datalist id="cars">
<option value="BMW">
<option value="Ford">
<option value="Volvo">
</datalist>
This produces the following result:
Browser Support
Chrome | Firefox | IE | Safari | Opera |
---|---|---|---|---|
20.0 | 4.0 | 10.0 | 9.0 |
Doctype Declaration Support
The following table lists the doctype declarations this element may appear in:
HTML4.01 / XHTML1.0 | XHTML 1.1 | HTML 5 | ||
---|---|---|---|---|
Traditional | Strict | Frameset | ||
Miscellaneous Information
Defined In: | HTML5 |
---|---|
Empty Tag: | No |