Execute a script when the element is being double-clicked in HTML?

HTMLWeb DevelopmentFront End Technology

Use the ondblclick attribute in HTML to execute a script when the element is being double-clicked in HTML.

Example

You can try to run the following code to implement the ondblclick attribute −

<!DOCTYPE html>
<html>
   <body>
      <button ondblclick = "display()">Click me twice</button>
      <script>
         function display() {
            alert("You double-clicked the button!");
         }
      </script>
   </body>
</html>
raja
Published on 14-Mar-2018 12:32:14
Advertisements