Reputation: 19848
Rather frustrating time here with IE9. This code works in IE7/8, but not 9.
document.getElementById('id').fireEvent("OnChange");
Any insight as to why?
Upvotes: 10
Views: 30937
Reputation: 51441
In IE versions >= 9 and all other browsers you should use the dispatchEvent
method:
var event = document.createEvent("HTMLEvents");
event.initEvent("change",true,false);
document.getElementById("id").dispatchEvent(event);
Check out http://jsfiddle.net/QKsvv/
Upvotes: 25