I'm trying to simulate mouse events like click, mouseover etc on app build in ExtJs. I'm using below code to simulate click,

```
function triggerEvent(element, eventName)
{
    if (document.createEvent)
    {
        var evt = document.createEvent('MouseEvents');
        evt.initEvent(eventName, true, true);

        return element.dispatchEvent(evt);
    }
}

var btn = document.getElementById("loginButton");

triggerEvent(btn, "click");

```

This works fine on chrome and firefox but never works on IE9 and IE10. If I use btn.fireEvent('onlclick') then it works fine in IE9 (not checked in IE10). document.createEvent is supported in IE9 & IE10 but I'm not sure why my code is not working.