JavascriptJquery, disabling all double clicks anywhere within body of web page? - Stack Overflow

I already have a lot of AJAX code written for a web app and didn't take into account the problems

I already have a lot of AJAX code written for a web app and didn't take into account the problems that double 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

I already have a lot of AJAX code written for a web app and didn't take into account the problems that double 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

Share Improve this question asked May 6, 2011 at 1:14 RickRick 17k35 gold badges113 silver badges163 bronze badges 2
  • did you actually mean 'double-clicking' in the meaning of two clicks w/ almost no pause between them, or clicking 2+ times on a button that is wired to an ajax call and thus would add another call on top of the old on, and so on....? – ampersand Commented May 6, 2011 at 2:45
  • 1 I mean double clicking like when you have to double click something on a windows desktop icon to open an application / file. While I don't do it myself, some of our users have problems with this action being ingrained in them so they double click everything on the web app – Rick Commented May 6, 2011 at 20:43
Add a ment  | 

3 Answers 3

Reset to default 5

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.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744505179a4577666.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信