files/en-us/web/api/element/dblclick_event/index.md
{{APIRef("UI Events")}}
The dblclick event fires when a pointing device button (such as a mouse's primary button) is double-clicked; that is, when it's rapidly clicked twice on a single element within a very short span of time.
dblclick fires after two {{domxref("Element/click_event", "click")}} events (and by extension, after two pairs of {{domxref("Element.mousedown_event", "mousedown")}} and {{domxref("Element.mouseup_event", "mouseup")}} events).
Use the event name in methods like {{domxref("EventTarget.addEventListener", "addEventListener()")}}, or set an event handler property.
addEventListener("dblclick", (event) => { })
ondblclick = (event) => { }
A {{domxref("MouseEvent")}}. Inherits from {{domxref("UIEvent")}} and {{domxref("Event")}}.
{{InheritanceDiagram("MouseEvent")}}
This interface also inherits properties of its parents, {{domxref("UIEvent")}} and {{domxref("Event")}}.
true if the <kbd>alt</kbd> key was down when the mouse event was fired.true if the <kbd>control</kbd> key was down when the mouse event was fired.true if the <kbd>meta</kbd> key was down when the mouse event was fired.true if the <kbd>shift</kbd> key was down when the mouse event was fired.MOZ_SOURCE_* constants).
This lets you, for example, determine whether a mouse event was generated by an actual mouse or by a touch event (which might affect the degree of accuracy with which you interpret the coordinates associated with the event).This example toggles the size of a card when you double click on it.
const card = document.querySelector("aside");
card.addEventListener("dblclick", (e) => {
card.classList.toggle("large");
});
<aside>
<h3>My Card</h3>
<p>Double click to resize this object.</p>
</aside>
aside {
background: #ffee99;
border-radius: 1em;
display: inline-block;
padding: 1em;
transform: scale(0.9);
transform-origin: 0 0;
transition: transform 0.6s;
user-select: none;
}
.large {
transform: scale(1.3);
}
{{EmbedLiveSample("Examples", 700, 200)}}
{{Specifications}}
{{Compat}}