The ondblclick property returns the onDblClick event handler code on the current element.
element.ondblclick = function;
function
is the name of a user-defined function, without the () suffix or any parameters, or an anonymous function declaration, such aselement.ondblclick = function() { console.log("ondblclick event detected!"); };
<html> <head> <title>ondblclick event example</title> <script type="text/javascript"> function initElement() { var p = document.getElementById("foo"); // NOTE: log(); or log(param); will NOT work here. // Must be a reference to a function name, not a function call. p.ondblclick = log; }; function log() { console.log("ondblclick Event detected!") } </script> <style type="text/css"> <!-- #foo { border: solid blue 2px; } --> </style> </head> <body onload="initElement()"> <span id="foo">My Event Element</span> <p>double-click on the above element.</p> </body> </html>
The dblclick event is raised when the user double clicks an element.
Specification | Status | Comment |
---|---|---|
HTML Living Standard The definition of 'ondblclick' in that specification. | Living Standard |
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari (WebKit) |
---|---|---|---|---|---|---|
Basic support | (Yes) | (Yes) | ? | ? | ? | ? |
Feature | Android | Android Webview | Firefox Mobile (Gecko) | Firefox OS | Edge | IE Mobile | Opera Mobile | Safari Mobile | Chrome for Android |
---|---|---|---|---|---|---|---|---|---|
Basic support | No support | No support | ? | ? | ? | ? | ? | ? | No support |
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/ondblclick