The HTML <datalist>
element contains a set of <option>
elements that represent the values available for other controls.
Content categories | Flow content, phrasing content. |
---|---|
Permitted content | Either phrasing content or zero or more <option> elements. |
Tag omission | None, both the starting and ending tag are mandatory. |
Permitted parents | Any element that accepts phrasing content. |
Permitted ARIA roles | None |
DOM interface | HTMLDataListElement |
Attributes
This element has no other attributes than the global attributes, common to all elements.
Examples
<label>Choose a browser from this list: <input list="browsers" name="myBrowser" /></label> <datalist id="browsers"> <option value="Chrome"> <option value="Firefox"> <option value="Internet Explorer"> <option value="Opera"> <option value="Safari"> <option value="Microsoft Edge"> </datalist>
Result
Specifications
Specification | Status | Comment |
---|---|---|
HTML Living Standard The definition of '<datalist>' in that specification. |
Living Standard | |
HTML5 The definition of '<datalist>' in that specification. |
Recommendation |
Browser compatibility
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Feature | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic support | 20 | Yes | 4 | 10 | 9.5 | No |
Feature | Android webview | Chrome for Android | Edge mobile | Firefox for Android | IE mobile | Opera Android | iOS Safari |
---|---|---|---|---|---|---|---|
Basic support | 33 | 33 | Yes | 4 | No | ? | No |
Polyfill
Include this polyfill to provide support for older and currently incompatible browsers:
datalist-polyfill
See also
Document Tags and Contributors
Tags:
Contributors to this page:
mfranzke,
teoli,
SahAssar,
mfluehr,
sideshowbarker,
Sheppy,
erikadoyle,
Lemondoge,
Sebastianz,
Smartronsc,
wnas,
chrisdavidmills,
multiwebinc,
Jeremie,
skan,
steelbrain,
dvdrtrgn,
mayconrem,
dbs,
jzorn,
akagr,
kscarfone,
baer,
FredB,
jswisher,
tregagnon,
ethertank,
medicdude,
ziyunfei,
abrahamwilliams,
cers,
fscholz,
Fyrd,
hobophobe,
McGurk,
osdm
Last updated by:
mfranzke,