【发布时间】:2017-04-02 18:39:52
【问题描述】:
$("button").on("click", function() {
$("select option").each(function() {
$(this).addClass("heavyError");
});
$("select option:selected").attr("selected", false);
});
.heavyError {
color: red;
font-weight: bold;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<select style="width:480px; height:100px;" multiple>
<option value="test-ss">test-ss</option>
</select>
<button>test</button>
如果在 IE 中运行,文本会被连字符截断,但在 Chrome 中可以正常工作。不知道这里发生了什么。是 IE 的错误还是某种错误?
【问题讨论】:
-
是的,我认为这是 IE 的问题(选择选项和多个)
-
我尝试了这种方法并登陆github.com/angular/angular.js/issues/11314
-
什么版本的IE?
-
@epascarello IE11。有趣的是,我无法用 IE9 重现此问题。
-
在 IE11 上我可以看到粗体字体值在 Computed 选项卡中被转换为 700
标签: javascript jquery html css internet-explorer