HTML ondblclick Event Attribute
Description
The ondblclick HTML event attribute specifies a JavaScript function to be executed when the user double-clicks on the element. It is part of the Event Attributes family, which can be used on any HTML element.
The ondblclick event fires after two click events, and by extension, after two pairs of mousedown and mouseup events. This means that the user must click on the element twice within a very short span of time in order for the ondblclick event to fire.
The ondblclick event can be used to perform a variety of actions, such as opening a new window, submitting a form, or playing a video. It is a common way to implement features such as image editing, text selection, and file dragging.
Here is an example of how to use the ondblclick event attribute:
<p ondblclick="alert('You double-clicked me!')">
Double-click me!
</p>
When the user double-clicks on the <p> element, the alert() function will be called, displaying a message box with the text "You double-clicked me!".
Syntax
<element ondblclick="script">
Values
- scriptThe name of the script to use when the event has been triggered.
Example
Browser Support
The following information will show you the current browser support for the HTML ondblclick event attribute. Hover over a browser icon to see the version that first introduced support for this HTML event attribute.
Desktop





Tablets & Mobile





