"bug" with onclick handlers in IE

I had an issue today with Internet Explorer. An object with an onClick handler worked fine in Firefox and Safari, but in IE the handler only fired every other click. In the course of debugging I discovered that if I clicked slowly, it worked on every click. I realized that this was because IE must be registering an onDblClick event instead of two onClick events. A little testing confirmed this. I searched to see if someone else had the same problem, and found this page. User jamescover had the same issue and found a solution: use the onMouseUp event to handle clicks instead of onClick. He also directed the focus in the onMouseDown event, but I found that part to be unnecessary in my application. A demo of his solution can be found here. I'll reproduce the code in this post in case that page ever gets taken down:

This one invokes the function onclick

This one focuses the text field onmousedown, then invokes the function onmouseup


Alex Rakoczy: Hey!

I've ran into this problem before as well. You may have better luck with an Event Observer on a particular element, rather than a literal onclick statement.


Clive: The reason is that IE goofed on the events front with double-click.
(e.g. Prototype.js isn't doing anything wrong, IE just sucks)

The bug is listed here


Unfortunately it ends up busting a bunch of things if you aren't aware of the bug.

Stanley: @Clive - Thanks man! that is exactly what I was experiencing on my end. I found this article when Googling and as you noted I'm using jQuery but it was still happening to me too. Will the blue e ever be fixed?