Max Checked Test

Logic to impose a maximum number of checked inputs (two in this demo).

Check a few boxes.

var warning = $(".message");

$("select").multiselect({ 
   header: "Choose only TWO items!",
   click: function(e){
       if( $(this).multiselect("widget").find("input:checked").length > 2 ){
           warning.addClass("error").removeClass("success").html("You can only check two checkboxes!");
           return false;
       } else {
           warning.addClass("success").removeClass("error").html("Check a few boxes.");
       }
   }
});