Summary
The HTML <datalist>
Element contains a set of {{HTMLElement("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 {{HTMLElement("option")}} elements.
- Tag omission {{no_tag_omission}}
- Permitted parent elements Any element that accepts phrasing content.
- DOM interface {{domxref("HTMLDataListElement")}}
Attributes
This element has no other attributes than the global attributes, common to all elements.
Examples
<div>Choose a browser from this list:</div> <input list="browsers" /> <datalist id="browsers"> <option value="Chrome"> <option value="Firefox"> <option value="Internet Explorer"> <option value="Opera"> <option value="Safari"> </datalist>
Result
{{EmbedLiveSample("Examples")}}
Specifications
Specification | Status | Comment |
---|---|---|
{{SpecName('HTML WHATWG', 'the-button-element.html#the-datalist-element', '<datalist>')}} | {{Spec2('HTML WHATWG')}} | |
{{SpecName('HTML5 W3C', 'the-datalist-element.html#the-datalist-element', '<datalist>')}} | {{Spec2('HTML5 W3C')}} |
Browser compatibility
{{CompatibilityTable}}
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | 20 | {{CompatGeckoDesktop("2.0")}} | 10 | 9.5 | {{CompatNo}} |
Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|
Basic support | 33 | {{CompatGeckoMobile("2.0")}} | {{CompatNo}} | 10 | {{CompatNo}} |
See also
- The {{HTMLElement("input")}} element, and more specifically its {{htmlattrxref("list", "input")}} attribute;
- The {{HTMLElement("option")}} element.
{{HTMLRef}}