Selecting and deselecting multiple checkboxes

Add following javascript code

function toogleAllCheckboxValue(val) {
$('.isSelect').prop('checked', val);
}

function setCheckboxHeaderValue(val) {
//alert(val);
if(!val) {
$('.checkBoxHeader').prop('checked', val);
} else {
var flag = true;
$('.isSelect').each(function() {
if(!$(this).is(':checked')) {
$('.checkBoxHeader').prop('checked', false);
flag = false;
return false;
}
});
if(flag) {
$('.checkBoxHeader').prop('checked', true);
}
}
Below is the screenshot which shows how these 
functions are related to checkboxes



Published by Sandeep Kumar

He is a Salesforce Certified Application Architect having 11+ years of experience in Salesforce.

Leave a Reply