显示选项:none 未隐藏在 IE 中 [英] Options with display:none not hidden in IE

查看:24
本文介绍了显示选项:none 未隐藏在 IE 中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个选择中有多个选项.我已经对选项进行了排序,并使用 jquery 禁用和隐藏了重复的选项.该代码在 chrome 和 firefox 中运行良好,但在 IE 和 safari 中,带有 display:none 的选项仍然显示.

I have multiple options in a select. I have sorted the options and disabled and hidden the duplicate options with jquery. The code works well in chrome and firefox but in IE and safari, the options with display:none are still showing up.

这是代码的jsfiddle:

Here is the jsfiddle of the code:

<select>
  <option value="5797">34</option>
  <option value="5809">37</option>
  ... 
  <option value="5653">71</option>
  <option disabled="" selected="selected" value="53">Eye</option>
  <option disabled="disabled" style="display: none;" value="5441">52</option>
  <option disabled="disabled" style="display: none;" value="5443">52</option>
  ...
  <option disabled="disabled" style="display: none;" value="5431">51</option>
</select>

http://jsfiddle.net/7vUdb/

推荐答案

IE 不支持 标签上的 style="display:none;".

IE doesn't support style="display:none;" on <option> tags.

您唯一的选择是删除它们 - 作为创建 HTML 的一部分,或通过客户端脚本.

Your only option is to remove them - either as part of the creation of the HTML, or via client-side script.

这篇关于显示选项:none 未隐藏在 IE 中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆