I realized that on a webpage, when a form’s UI (checkbox, dropdown list, etc) is changed programmatically, the event handler (onchanged) is not fired? Is this a standard rule — that when a control is changed programmatically, the event handler will never get triggered? Is there any exception?
Share
That is correct, unless as Pointy “pointed” out, you are also firing the event. In jQuery this is as easy as adding a call to
.change()in your code that is changing the form.Ex. –
Html:
jQuery:
jsFiddle working example – http://jsfiddle.net/qGLc2/