Created
June 16, 2019 08:44
-
-
Save lumpysimon/adc43fa0cb671bf7fb447e9f2c550d6f to your computer and use it in GitHub Desktop.
jQuery snippet to limit how many checkboxes can be checked
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
$( '.things' ).click( function() { | |
var bol = $( '.things:checked' ).length >= 8; | |
$( '.things' ).not( ':checked' ).attr( 'disabled', bol ); | |
}); | |
// from http://stackoverflow.com/questions/2966382/limit-checkbox-amount |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment