iCheck example
HTML
<script src="https://cdn.rawgit.com/fronteed/icheck/1.x/icheck.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdn.rawgit.com/bantikyan/icheck-bootstrap/master/icheck-bootstrap.min.css">
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/iCheck/1.0.1/skins/square/grey.css">
<table id="tab" class="table">
<tr>
<td>
<input name="feature-1" class="ExtraCheckBox" type="checkbox"> Primary
</td>
<td>
<input name="feature-1" class="ChildCheckBox" type="checkbox"> Secondary
<input name="feature-1" class="ChildCheckBox" type="checkbox"> Secondary
</td>
</tr>
</table>
JavaScript
jQuery('input').iCheck({
checkboxClass: 'icheckbox_square-grey',
radioClass: 'iradio_square-blue',
increaseArea: '20%' // optional
});
$(document).on('change', '.ExtraCheckBox', function() {
var checked = $(".ExtraCheckBox").closest('div.icheckbox_square-grey').hasClass("checked");
console.log(checked);
if (checked) {
$("#tab > tr >td.ChildCheckBox").each(function() {
$(this).prop("checked", true);
});
} else {
$("#tab > tr >td.ChildCheckBox").each(function() {
$(this).prop("checked", false);
});
}
});