I use icheck class class=flat-red .I want check All in icheck
<div class="form-group" >
<input type="checkbox" class="flat-red " id="checkAll" >
Check All
</div>
<div id="checkDetails">
<div class="form-group">
1<input type="checkbox" class="flat-red check" >
</div>
<div class="form-group">
2<input type="checkbox" class="flat-red check">
</div>
<div class="form-group">
3<input type="checkbox" class="flat-red check">
</div>
<div class="form-group">
4<input type="checkbox" class="flat-red check">
</div>
<div class="form-group">
5<input type="checkbox" class="flat-red check">
</div>
<div class="form-group">
6<input type="checkbox" class="flat-red check">
</div>
<div class="form-group">
7<input type="checkbox" class="flat-red check">
</div>
</div>
$(function () {
var checkAll = $('input#checkAll');
var checkboxes = $('input.flat-red');
checkAll.on('ifChecked ifUnchecked', function(event) {
if (event.type == 'ifChecked') {
checkboxes.iCheck('check');
} else {
checkboxes.iCheck('uncheck');
}
});
checkboxes.on('ifChanged', function(event {
if(checkboxes.filter(':checked').length == checkboxes.length) {
checkAll.prop('checked', 'checked');
} else {
checkAll.removeProp('checked');
}
checkAll.iCheck('update');
});
});
Aucun commentaire:
Enregistrer un commentaire