SetTimeout is not working for the follwing code:
$("#clkDblClk").click(function(){
var clickTimer=setTimeout(function(){
//Some code to execute
},1000);
$(this).data("clickTimer",clickTimer);
});
$("#clkDblClk").dblclick(function(){
var clickTimer=$(this).data("clickTimer");
clearTimeout(clickTimer);
//Some ajaxRequest
});
The element is registered for both click and double click events.To cancel out click event on doubleclick, setTimeout function is registered.I get the Ineger timer id in double click method, but clearTimeout is not cancelling out the function to execute. I'm not getting the error. Thanks in advance.