I am currently looking for an event listener for input type=checkbox that fires when disable state changes
I do not want to add the event to the first trigger which changes the checkbox state. It must be independent, for the trigger may change.
What I have tried so far:
$(function(){
$('.trigger').live('click', function(){
$('.eventbox').attr('disabled','disabled');
});
$('.eventbox').live('change', function(){
alert('state changed');
});
});
Unfortunately change doesn't work.
thank you for your help. jesse
can you put a trigger on the thing that does the checkbox disabling? By that I mean, if you have some button that as a side effect disables some checkboxes on click, could you tack you listener onto the click of the button?
Try this. I think you really want to track checking/unchecking of checkbox and not enabling/disabling.
$(function(){
$('.trigger').live('click', function(){
$('.eventbox').removeAttr('checked');
});
$('.eventbox').live('change', function(){
alert('state changed');// this will be fired only if state was checked
});
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.