有没有办法用datalist填充select元素

时间:2017-09-08 22:01:30

标签: html5

对于input元素,我们可以将datalist元素用作自动完成

<input name="account" placeholder="account" list="publisher">

<datalist id="publisher">
  <option value="00000" >00000</option>
  <option value="00001" >00001</option>
  <option value="00002">00002</option>
</datalist>

select元素的方法吗?不自动完成只需用选项填充选项,例如:

the two example should be equivalent
<select name=account>
  <option value="00000" >00000</option>
  <option value="00001" >00001</option>
  <option value="00002">00002</option>
</select>
and that 
<select name="account" list="publisher"></select>

0 个答案:

没有答案