Skip to content

Instantly share code, notes, and snippets.

@esbanarango
Created June 7, 2012 19:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save esbanarango/2891164 to your computer and use it in GitHub Desktop.
Save esbanarango/2891164 to your computer and use it in GitHub Desktop.
Chosen.js set the number of multiple select that you want.
º/*In this example I want the user to choose maximum 2*/
$('#id').chosen().change(function(event) {
if($(this).val()!=null){
if ($(this).val().length > 1) {
$(".chzn-drop").css("display","none");
}
if ($(this).val().length < 2) {
$(".chzn-drop").css("display","block");
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment