HTML <datalist>元素包含了一组<option>元素,这些元素表示其它表单控件可选值.

属性

该元素除了公用的全局属性之外,没有其他属性。

示例

<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">
</datalist>
 
 
 
 
 
 
 
 
 

结果

规范

规范 状态 备注
HTML Living Standard
<datalist>
Living Standard  
HTML5
<datalist>
Recommendation  

浏览器兼容性

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
datalistChrome Full support 20Edge Full support YesFirefox Full support 4IE Full support 10Opera Full support 9.5Safari Full support 12.1WebView Android No support NoChrome Android Full support 33Edge Mobile Full support YesFirefox Android Full support 4Opera Android ? Safari iOS Full support 12.2Samsung Internet Android Full support Yes

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown

Polyfill

以下Polyfill旨在支持旧的或者目前不兼容的浏览器:datalist-polyfill

参见

文档标签和贡献者

标签: 
最后编辑者: mdnwebdocs-bot,