<script>
//實現全選與反選
$(".allAndNotAll").click(function () {
if ($(this).prop("checked")) {
$("input[id=inlineCheckbox1]:checkbox").each(function () {
$(this).prop("checked", true);
});
} else {
$("input[id=inlineCheckbox1]:checkbox").each(function () {
$(this).prop("checked", false);
});
}
});
//當其中不勾選某一個選項的時候,則去掉全選復選框
$(":checkbox[id=inlineCheckbox1]").click(function () {
$(".allAndNotAll").prop('checked',
$(":checkbox[id=inlineCheckbox1]").length == $(":checkbox[id=inlineCheckbox1]:checked").length);
});
</script>
<!-- 全選按鈕 -->
<label for="exampleInputEmail2">全選</label>
<input type="checkbox" class="allAndNotAll">
<!-- 單選框 -->
<td><input type="checkbox" value="{{ data.id }}" name="product_bound_id" id="inlineCheckbox1"></td>