87,904
社区成员
发帖
与我相关
我的任务
分享
//除了表头(第一行)以外所有的行添加click事件.
$("tr").first().nextAll().click(function () {
//为点击的这一行切换样式bgRed里的代码:background-color:#FF0000;
//判断td标记的背景颜色和body的背景颜色是否相同;
//if ($(this).children().css("background-color") == 'transparent' || $(this).children().css("background-color") == 'rgb(255, 255, 255)')
if ($(this).children().find("input[name*='chkId']").prop('checked')) {
//如果相同,CheckBox.checked=true;
$(this).children().find("input[name*='chkId']").prop("checked", false);
$(this).children().removeClass("bgRed");
} else {
//如果不同,CheckBox.checked=false;
$(this).children().find("input[name*='chkId']").prop("checked", true);
$(this).children().addClass("bgRed");
}
});
//除了表头(第一行)以外所有的行添加click事件.
$("tr").first().nextAll().click(function (e) {
if($(e.target).is('input')) return;
//为点击的这一行切换样式bgRed里的代码:background-color:#FF0000;
//判断td标记的背景颜色和body的背景颜色是否相同;
//if ($(this).children().css("background-color") == 'transparent' || $(this).children().css("background-color") == 'rgb(255, 255, 255)')
if ($(this).children().find("input[name*='chkId']").prop('checked')) {
//如果相同,CheckBox.checked=true;
$(this).children().find("input[name*='chkId']").prop("checked", false);
$(this).children().removeClass("bgRed");
} else {
//如果不同,CheckBox.checked=false;
$(this).children().find("input[name*='chkId']").prop("checked", true);
$(this).children().addClass("bgRed");
}
});