Twitter Bootstrap に Bootstrap Switch を使用しています。ここで、グローバルチェックボックスのチェックまたはチェック解除に基づいて、すべてのチェックボックスをチェックまたはチェック解除するのに問題があります
ここにブートストラップ スイッチのリンクがあります http://www.bootstrap-switch.org/
これが私がやったことです
<!-- this is the global checkbox -->
<div class="make-switch switch-mini">
<input type="checkbox" id="rowSelectAll">
</div>
<!-- row checkboxs -->
<div class="make-switch switch-mini">
<input type="checkbox" class="row-select">
</div>
<div class="make-switch switch-mini">
<input type="checkbox" class="row-select">
</div>
<div class="make-switch switch-mini">
<input type="checkbox" class="row-select">
</div>
jQuery:
$("#rowSelectAll").click(function () {
$(".row-select").prop('checked', $(this).prop('checked'));
});
編集: 1 つのグローバル チェックボックスと 1 つのローカル チェックボックスだけを試してみました
<div class="make-switch switch-mini">
<input type="checkbox" id="rowSelectAll">
</div>
<div id="toggle-state-switch" class="make-switch switch-mini row-select">
<input type="checkbox" class="">
</div>