【发布时间】:2012-09-18 01:55:43
【问题描述】:
鉴于这个简单的 html,
<select id="ddl">
<option style="background:#0f0">a</option>
<option style="background:#f00;">b</option>
<option>c</option>
</select>
(http://jsfiddle.net/DxK47/) 您可以看到每个选项都有自己的背景颜色。
Unfortunately, when whatever option is selected (causing the dropdownlist to 'close'), the background remains white (or whatever the page default is).
选择后是否可以在下拉列表中显示所选项目的背景(最好不使用javascript)
【问题讨论】:
-
我在 chrome 中发现了这个问题,在 IE 中没有,刚刚尝试了你的小提琴,它在 IE 中正常工作,你可以试试吗?
-
你想要没有JS的解决方案吗?
标签: javascript jquery html css