js部分
function checkit(isChecked) {
$(".product-checked").each(function () {
$(this).prop({'checked': isChecked});
})
}
html部分
<label class="checkbox" style="border: none;">
<input type="checkbox" onclick="checkit(this.checked)">全选
</label>
<input type="checkbox" class="product-checked">1
<input type="checkbox" class="product-checked">2
<input type="checkbox" class="product-checked">3
<input type="checkbox" class="product-checked">4