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

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -