标签:
全选按钮:<input type=\"checkbox\" id=\"cheSelectAll\" />选择</li>");
选择项:<input name=\"chkItem\" type=\"checkbox\" value=\"" + this.ID + "\" />
//全选反选
$("#cheSelectAll").click(function() {
$("input[name='chkItem']").prop("checked", $(this).is(":checked"));
});
$("#cheSelectAll").prop("checked", false);
//绑定选中事件
$("input[name='chkItem']").bind("click", function() {
if ($(this).is(":checked") && $("input[name='chkItem']:checked").length === $("input[name='chkItem']").length) {
$("#cheSelectAll").prop("checked", true);
} else {
$("#cheSelectAll").prop("checked", false);
}
});标签:
原文地址:http://blog.csdn.net/wanlong360599336/article/details/45198943