Mouse click simulation via javascript:

1
2
3
4
5
6
7
if (!HTMLElement.click) {
  HTMLElement.prototype.click = function() {
    var evt = this.ownerDocument.createEvent('MouseEvents');
    evt.initMouseEvent('click', true, true, this.ownerDocument.defaultView, 1, 0, 0, 0, 0, false, false, false, false, 0, null);
    this.dispatchEvent(evt);
  }
}

Usage: document.getElementById(‘my-element’).click()

HTMLElement.click should be defined in Internet Explorer by default.