继续回馈ITEYE, 绝对原创,JQuery实现CheckBox全选
选择全部的那个checkbox的id设为CheckAll
$(function () {
// Checkbox 全选
$("#CheckAll").click(function () {
if ($(this).attr("checked") == "checked") { // 全选
$("input[type='checkbox']").each(function () {
if ($(this).attr("disabled") != "disabled" && $(this).attr("disabled") != "chkIS_SM")
$(this).attr("checked", true);
});
} else { // 取消全选
$("input[type='checkbox']").each(function () {
if ($(this).attr("disabled") != "disabled" && $(this).attr("disabled") != "chkIS_SM")
$(this).attr("checked", false);
});
}
});
});
选择全部的那个checkbox的id设为CheckAll
$(function () {
// Checkbox 全选
$("#CheckAll").click(function () {
if ($(this).attr("checked") == "checked") { // 全选
$("input[type='checkbox']").each(function () {
if ($(this).attr("disabled") != "disabled" && $(this).attr("disabled") != "chkIS_SM")
$(this).attr("checked", true);
});
} else { // 取消全选
$("input[type='checkbox']").each(function () {
if ($(this).attr("disabled") != "disabled" && $(this).attr("disabled") != "chkIS_SM")
$(this).attr("checked", false);
});
}
});
});