我试图让一个<datalist>
元素列出两个“<select>
一个水果”元素的水果。
给定html:
Select one fruit: <select type="text" name="fruit1" list="fruits"></select>
Select a second fruit: <select type="text" name="fruit2" list="fruits"></select>
<datalist id="fruits">
<option value="Blackberry">Blackberry</option>
<option value="Blackcurrant">Blackcurrant</option>
<option value="Blueberry">Blueberry</option>
<!-- … -->
</datalist>
包含第二个<select>
破坏我的代码(小提琴演示)。如何处理以使它们都在相同的数据列表(或类似的值列表)上工作。
编辑: <select />
更正为<select></select>
(@richard)