SetTimeout does not work for the following code:
$("#clkDblClk").click(function(){
var clickTimer=setTimeout(function(){
},1000);
$(this).data("clickTimer",clickTimer);
});
$("#clkDblClk").dblclick(function(){
var clickTimer=$(this).data("clickTimer");
clearTimeout(clickTimer);
});
The item is registered for both click events and double-click. To cancel the click event on doubleclick, the setTimeout function is registered. I get the Ineger timer id using the double click method, but clearTimeout does not cancel the function being executed. I do not get an error. Thanks in advance.
source
share