日期:2014-05-17 浏览次数:20705 次
$("#chkAll").click(function () {
if (this.checked) {
$("input[name='chkId']").each(function () { this.checked = true; });
}
else {
$("input[name='chkId']").each(function () { this.checked = false; });
}
});
<input type="checkbox" id="chkAll" />全选
<input type="checkbox" name="chkId" value="id1" />
<input type="checkbox" name="chkId" value="id2" />