How to disable ondblclick in javascript?

Is it possible to disable the ondblclick event?

+4
source share
3 answers
 document.ondblclick = function() { return false; } 

... or if you do not want to do this throughout the site.

 document.getElementById('something').ondblclick = function() { return false; } 
+6
source

You can use:

 event.preventDefault(); event.stopPropagation(); event.stopImmediatePropagation(); 
0
source
 <script type="text/javascript"> document.ondblclick = function DoubleClick(evt) { if (window.getSelection) window.getSelection().removeAllRanges(); else if (document.selection) document.selection.empty(); } </script> 

This code will disable the double-click text selection.

-1
source

All Articles