4

Is it possible to disable the ondblclick event?

alex
  • 479,566
  • 201
  • 878
  • 984
Robert
  • 815
  • 13
  • 29

3 Answers3

7
document.ondblclick = function() { return false; }

...or if you didn't want to do it site-wide.

document.getElementById('something').ondblclick = function() { return false; }
alex
  • 479,566
  • 201
  • 878
  • 984
0

You can use:

event.preventDefault();
event.stopPropagation(); 
event.stopImmediatePropagation();
-1
<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 selecting text via double click

sumesh
  • 33
  • 1
  • 4