Is there an event for checkbox change when the state is changed/modified based on some other interaction. I mean not by clicking on the text box.
I’ve tried this code:
$('input[type="checkbox"]').bind('change',function(){
alert('Checkbox state is changed.');
});
…but as you can see in this demo, if I click the checkbox I see an alert showing “Checkbox state is changed.” message triggered by the change event. But the same is not triggered when the checkbox state is changed using the button.
Am I missing anything?
Appreciate any help.
The problem is you’re modifying the attribute “checked” in the
DOMbut the same event handler is not being called.In your button event click you could use
triggerand do:http://jsfiddle.net/wmVtB/7/