Scripts
var timer;
var firing = false;
var begen = function(id) {
alert('one click');
};
var popupAc = function(id) {
alert('double click');
};
function cc(id) {
if (firing) {
popupAc(id);
clearTimeout(timer);
firing = false;
return;
}
firing = true;
timer = setTimeout(function() {
begen(id);
clearTimeout(timer);
firing = false;
}, 250);
}
Html
<div id="myID" onclick="cc()">Click Here</div>
Example: http://jsfiddle.net/LXSZj/11/
Question:
It works fine with ie and chrome, But in firefox, when I double click, I get two alert functions.(alert double click event and one click event)
How can I fix It?
Thanks.
if(firing)you can doif(timer).