HTML ondblclick Event Attribute

Description

The event attribute ondblclick allows you to set the script to fire after double-clicking on an element.

Syntax

<element ondblclick="script">

Values

  • scriptThe name of the script to use when the event has been triggered.

Example

<!DOCTYPE html> 
  <html> 
  <head>
    <title>Event attribute ondblclick</title> 
  </head> 
  <body> 
    <p id="demo2">Double-click on the button to run the script:</p> 
    <button ondblclick="mouseTest2()">Double click on me!</button> 
<script> 
  function mouseTest2 () { 
  var x = document.getElementById ("demo2"); 
  x.style.fontSize = "25px";  
  x.style.color = "orange";  
  x.style.backgroundColor = "#555555"; 
} 
</script> 
  </body> 
</html>

Supported Tags

All HTML elements except:
<base>, <bdo>, <br>, <head>, <html>, <iframe>, <meta>, <param>, <script>, <style> and <title>

Browser Support

Desktop
Explorer Edge Chrome Firefox Opera Safari
XYesYesYesXX
Tablets / Mobile
Android Chrome Firefox Opera Safari Samsung
XXXXXX