Last active
January 2, 2016 10:58
-
-
Save wangwen1220/8293165 to your computer and use it in GitHub Desktop.
JS: jQuery 限制选择框选择个数 | limit select length
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// jQuery 限制选择框选择个数 | |
$("#categories option").click(function(e) { | |
if ($(this).parent().val().length < 2) { | |
$(this).removeAttr("selected"); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment