Menu
×
   ❮     
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS R TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI GO KOTLIN SASS VUE DSA GEN AI SCIPY CYBERSECURITY DATA SCIENCE
     ❯   

HTML ondblclick Attribute


Definition and Usage

The ondblclick attribute fires on a mouse double-click on the element.


Applies to

The ondblclick attribute is part of the Event Attributes, and can be used on any HTML elements.

Elements Event
All HTML elements ondblclick

Examples

Button Example

Execute a JavaScript when a button is double-clicked:

<button ondblclick="myFunction()">Double-click me</button>
Try it Yourself »

P Example

Double-click on a <p> element to change its text color to red:

<p id="demo" ondblclick="myFunction()">Double-click me to change my text color.</p>

<script>
function myFunction() {
    document.getElementById("demo").style.color = "red";
}
</script>
Try it Yourself »

Browser Support

Event Attribute
ondblclick Yes Yes Yes Yes Yes