As of June 2016 (using jquery 2.1.4) none of the other suggested solutions work. Checking attr('checked')
always returns undefined
and is('checked)
always returns false
.
Just use the prop method:
$("#checkbox").change(function(e) {
if ($(this).prop('checked')){
console.log('checked');
}
});