Skip to content

Instantly share code, notes, and snippets.

@lumpysimon
Created June 16, 2019 08:44
Show Gist options
  • Save lumpysimon/adc43fa0cb671bf7fb447e9f2c550d6f to your computer and use it in GitHub Desktop.
Save lumpysimon/adc43fa0cb671bf7fb447e9f2c550d6f to your computer and use it in GitHub Desktop.
jQuery snippet to limit how many checkboxes can be checked
$( '.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