勾选与ie8的兼容

var isIE=!!window.ActiveXObject;
var isIE8=isIE&&document.documentMode<9;

$('#checkAll').on("click", function () {
                    if (this.checked) {
                        staffOrgIdList = [];
                        $(this).prop("checked",true);
                        if(isIE8){
                            $(this).next().css("background-position","0px -40px");
                        }
                        $("input[name='ckbs']").each(function () {
                            $(this).prop("checked",true);
                            $(this).parent().parent().addClass('selected');
                            staffOrgIdList.push($(this).attr("val"));
                        });
                    } else {
                        $(this).removeAttr('checked');
                        if(isIE8){
                            $(this).next().css("background-position","0px 0px");
                        }
                        $("input[name='ckbs']").each(function () {
                            $(this).removeAttr('checked');
                            $(this).parent().parent().removeClass('selected');
                            staffOrgIdList = [];
                        });
                    }
                })
posted @ 2019-09-30 16:52  羲兮cf  阅读(156)  评论(0编辑  收藏  举报