Last active
February 23, 2016 18:51
-
-
Save juanbrujo/15e3648b34a6e679bac3 to your computer and use it in GitHub Desktop.
jQuery checkboxes attach event on change state
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
// react then checkbox change state | |
$('input[type="checkbox"]').on('change', function(e) { | |
if( this.checked ) { | |
console.log('checked'); | |
} else { | |
console.log('not checked'); | |
} | |
}); | |
// check | |
$('input[type="checkbox"]').prop('checked', true); | |
// uncheck | |
$('input[type="checkbox"]').prop('checked', false); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment