开发者

Javascript / Jquery, disabling all double clicks anywhere within body of web page?

I already have a lot of AJAX code written for a web app and didn't take into account the problems that doub开发者_Go百科le clicks on some things can cause. I already implemented an "inprogress" variable for sensitive AJAX calls so that it won't be messed up by double clicking by the user but I am wondering if there is a simple way to just disable all double clicks anywhere (in any element) within the entire body of the web page rather than having to do it individually for each specific element.

Thanks for any advice


Try something crazy like this:

$("*").dblclick(function (event)
{
    event.preventDefault();
});

In theory, it would capture the double-click event on any element and then basically do nothing (cancels the default action).


$('*').dblclick(function(event) { event.preventDefault(); return false; });

Should handle it, however there is probably a better solution out there.


If you havn't bound events to double click, double click will do nothing. It is event of its own.
Click and DoubleClick are different events.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜