admin管理员组文章数量:1386750
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
3 Answers
Reset to default 5Try 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.
本文标签: JavaScriptJQuerydisabling all double clicks anywhere within body of web pageStack Overflow
版权声明:本文标题:JavascriptJquery, disabling all double clicks anywhere within body of web page? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744505179a2609552.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论