You are here: Reference > JavaScript > client-side > event handling > events > ondblclick

ondblclick event | dblclick event

Browser support:
Occurs when the user double clicks on an element.

How to register:

In HTML:
<ELEMENT ondblclick="handler">

In JavaScript:
object.ondblclick = handler;
object.addEventListener ("dblclick", handler, useCapture);
9
object.attachEvent ("ondblclick", handler);
You can find the related objects in the Supported by objects section below.
The event object is accessible to all event handlers in all browsers. The properties of the event object contain additional information about the current event. To get further details about these properties and the possible event handler registration methods, please see the page for the event object.
For a complete list of events, see the page for Events in JavaScript.

Basic information:

Bubbles Yes
Cancelable Yes
Event object MouseEvent

Actions that invoke the ondblclick event:

  • Clicking on the left mouse button twice on the same element quickly without moving the mouse.

The order of events related to the ondblclick event:

Internet Explorer Firefox, Opera, Google Chrome, Safari
  1. onmousedown
  2. onmouseup
  3. onclick
  4. onmouseup
  5. ondblclick
  1. onmousedown
  2. onclick
  3. onmousedown
  4. onclick
  5. ondblclick

Example HTML code 1:

This example illustrates the use of the ondblclick event:
<head>
    <script type="text/javascript">
        function OnDblClickSpan () {
            alert ("You have double-clicked on the text!");
        }
    </script>
</head>
<body>
    <span ondblclick="OnDblClickSpan ()">Click on me twice and fast!</span>
</body>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content