jquery - Add event handler when checkbox becomes disabled -
is there way add event handler (like .on('change' ..)
checkbox when becomes disabled?
i tried (see jsfiddle), not fire when disable checkbox:
$('#mycb').on('change', function() { console.log('checkbox disabled? ' + $('#mycb').is(':disabled')); }); $('#mycb').prop('disabled', true); // not trigger function above
edit: want add logic checkbox because in application don't know when checkbox might become disabled.
the simplest way should be:
$('#mycb').prop('disabled', true).triggerhandler('change');
Comments
Post a Comment