[英]JavaScript add class on click works in IE9, doesn't work in IE7-8
I'm using a script to:我正在使用脚本来:
It works fine in every browser (including IE9) but fails in IE7 and IE8.它在每个浏览器(包括 IE9)中都可以正常工作,但在 IE7 和 IE8 中失败。 In IE7 - 8 clicking the element has no effect.
在 IE7 - 8 中单击元素无效。 It neither adds the class nor changes the checkbox state.
它既不添加 class 也不更改复选框 state。
/** BEGIN CheckBox **/
$.fn.xCheckBoxList = function () {
this.Check = function (clientId, isSingleSelection) {
$(document).ready(function () {
var checkBox = $("#" + clientId + " .x_checkBox");
$(checkBox).has("input:checked").addClass("x_checkBoxChecked");
$(checkBox).click(function () {
if (isSingleSelection) {
$(this).siblings().find("input").attr("checked", false);
}
$(checkBox).has("input:checked").addClass("x_checkBoxChecked");
$(checkBox).has("input:not(:checked)").removeClass("x_checkBoxChecked");
});
});
}
return this;
}
/** END CheckBox **/
Any ideas?有任何想法吗?
I have the same issue.我有同样的问题。 It seems that simply addClass and other Mootools 1.2 methods do not work in IE8.
似乎简单的 addClass 和其他 Mootools 1.2 方法在 IE8 中不起作用。 Some alternative implementations should be provided to make this work in IE8.
应该提供一些替代实现来使这项工作在 IE8 中工作。 If you have found a better solution please let us know
如果您找到了更好的解决方案,请告诉我们
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.