var maxCount = 3;
$("#typeCheckboxSelect").multiselect({
includeSelectAllOption: true,
enableCaseInsensitiveFiltering: true,
numberDisplayed: 1,
maxHeight: 250,
includeSelectAllOption: false,
onChange: function(option) {
//Get selected count
var selectedCount = $("#typeCheckboxSelect").find("option:selected").length;
//If the selected count is equal to the max allowed count (3 here), then disable any unchecked boxes
if (selectedCount >= maxCount) {
$("#typeCheckboxSelect option:not(:selected)").prop('disabled', true);
$("#typeCheckboxSelect").multiselect('refresh');
alert("Only allowed to select " + maxCount + " options.");
}
//If the selected count is less than the max allowed count (3 here), then set all boxes to enabled
else {
$("#typeCheckboxSelect option:disabled").prop('disabled', false);
$("#typeCheckboxSelect").multiselect('refresh');
}
} 
});