I am using Bootstrap Switch for Twitter Bootstrap. Here I have a problem to check or uncheck all checkboxes based on the global checkmark checked or unchecked
Here is the bootstrap switch link http://www.bootstrap-switch.org/
Here is what i did
<!-- 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')); });
EDIT: tried only one global and one local flag
<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>
jquery twitter-bootstrap
Code lover
source share