当复选框 id="checkAll"
被选中时,如何清除所有复选框?
在我的演示中,当用户选中复选框时 id="checkAll"
所有复选框都被选中
但是我想申请,当用户选中复选框时 id="checkAll"
所有复选框都被清除,我该怎么办?
http://jsfiddle.net/peap/sydzL8Lc/1/
$('#checkAll').click(function () {
$('input:checkbox').prop('checked', this.checked);
});
最佳答案
只需应用 this.checked
的否定
$('#checkAll').change(function () {
$('input:checkbox').not(this).prop('checked', !this.checked);
});
关于javascript - 选中复选框ID ="checkAll"时如何清除所有复选框?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25812750/