I have a bunch of input elements on a page. Each input element has an onchange event that triggers an ajax call to the server. I want to disable all these onchanges then make some programatic changes to the elements (reset them), then re-enable these onchange events. I want only one ajax call to happen as a result of this.
How do I do this using JQuery?
Many Thanks!
Changing an input elements value through
.val()doesn’t trigger a change event so you can set your values and then trigger the change event at the end by hand:Demo: http://jsfiddle.net/ambiguous/Qd2Ad/
From the fine manual:
There is no focus change when you just call
valso there is no event.