Disable mouse double click using javascript or jquery

前端 未结 5 2012
借酒劲吻你
借酒劲吻你 2021-01-05 07:17

I have a form in which i have some text boxes and below to it there is a table.When i double click on table row it takes me to another page.

Now the problem is if i

5条回答
  •  说谎
    说谎 (楼主)
    2021-01-05 08:02

    Got the following code from here

    jQuery code to disable double click event on the webpage.

    $(document).ready(function(){
          $("*").dblclick(function(e){
            e.preventDefault();
          });   
        });
    

    Above jQuery code will disable double click event for all the controls on the webpage. If you want to disable for specific control, let's say a button with ID "btnSubmit" then,

    $(document).ready(function(){
          $('#btnSubmit').dblclick(function(e){
            e.preventDefault();
          });   
        });
    

提交回复
热议问题