Is It Possible To Dispatchevent() A Mouse Click To A Element?
Basically I'm trying to dispatch a custom made mouse click event to a text input element using the following code (see this jsFiddle): function simulateClick(id) { var clickEve
Solution 1:
As far as i can tell your code works fine. However it does not focus the input field as you may think, but the event is fired on the input field just fine, as seen in this fiddle: http://jsfiddle.net/ENvZY/
Note: the code is not crossbrowser compatible though, it fails in ie8.
Consider using a good crossbrowser library like jQuery instead of going the native DOM way - the wheel exists and works perfectly, reinventing it is a waste of time :)
Post a Comment for "Is It Possible To Dispatchevent() A Mouse Click To A Element?"