Below code works fine in Firefox, but not in IE8.
It triggers mouse click event on HTML element (here specified as ‘node’ ) and
invokes function already bound to that element.
So its like triggering the click event on given element programmatically.
var oEvent = document.createEvent( \"MouseEvents\" );
oEvent.initMouseEvent(\"click\", true, true, window, 1, 1, 1, 1, 1, false, false, false, false, 0, node);
node.dispatchEvent(oEvent);
Can anybody help me to make it work in IE8 ?
Thanks in advance.
You only need code like that for Firefox on elements that did not already have a click event!
Just click the element in other browsers – for example node.click()
This means you need to sniff the event. I would try