Monday, May 20, 2024
171
rated 0 times [  173] [ 2]  / answers: 1 / hits: 30871  / 12 Years ago, thu, march 15, 2012, 12:00:00

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?


More From » internet-explorer

 Answers
13

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/


[#86834] Wednesday, March 14, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
josuea

Total Points: 609
Total Questions: 121
Total Answers: 104

Location: South Georgia
Member since Fri, Nov 13, 2020
4 Years ago
josuea questions
;