没有选项的 Internet Explorer 下拉菜单显示大的空下拉菜单

Internet Explorer dropdown without options displays large empty dropdown

我有空 html select.

在 Chrome 和 Firefox 中,当您单击下拉列表时,它正确地显示没有任何元素。

在 Internet Explorer 中,单击下拉箭头会显示一个空的下拉列表,看起来大约有 10 行长。

为什么 Internet Explorer 会这样,是否有解决方法?

示例代码:

<select id="ExampleDropdown" name="ExampleDropdown"></select>

示例fiddle: http://jsfiddle.net/s1e7ydf9/3/

好吧,IE 又做了一次,有一种修复方法,如果你在 select 中放置一个空白选项,它应该会给你一个跨浏览器的空白 select,fiddle.

<select><option/></select>

如果 select 没有选项,您也可以禁用它,然后使用 JavaScript、fiddle

启用它
<select disabled></select>

之后:

((select)).disabled = false;

希望对您有所帮助,再见!