I’m trying to have an element which support both click and double click on it. But the following example works in IE but does not work in FireFox 3.5.6:
<button onclick="c=setTimeout('alert(1);',1000);" ondblclick="clearTimeout(c);alert(2);">Test</button>
It just doesn’t clear timeout, so alert(1) is being fired.
Does anyone know what is the issue?
How I can have click and double click events separately in FireFox?
When you double-click in Firefox, you get two click events and then a dblclick event. So you’re setting two timers and clearing one. Clearing the timer on the click event should work: