Fire an Event manually on IE > 5

/ Published in: JavaScript
Save to your folder(s)

IE doesn't follow the W3 specification about DOM Events

Copy this code and paste it in your HTML
  1. var srcElement = document.getElementById('source');
  2. if(document.createEventObject) {
  3. var ev = document.createEventObject();
  4. //event object can define common properties (see the URL)
  6. //1st param: event type fired, 2nd event object
  7. srcElement.fireEvent('onclick', ev);
  8. }


Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.