$(function () {
//it is use for selectall and if any not checked so selectall is unchecked
var checkall = $('#checkall');
var boxes = $('input[type="checkbox"]').not(checkall);
checkall.click(function () {
boxes.attr('checked', this.checked);
});
boxes.change(function () {
checkall[0].checked = this.checked && boxes.filter(':checked').length === boxes.length;
});
//this is for show the value of selected checkbox in the div id+"checked"
$('input:checkbox').click(function () {
var $checked = $('#checked');
$checked.html('');
$('input:checkbox').each(function (index) {
if ($(this).is(':checked')) {
$checked.append('<div>' + $('label[for="' + $(this).attr('id') + '"]').text() + '</div>');
}
});
});
});