Horje

How to Execute a JavaScript when a button is double-clicked

A function is triggered when the button is double-clicked. The function outputs some text in a p element with id="demo".

index.html
Example: HTML
<!DOCTYPE html>
<html>
<body>

<button ondblclick="myFunction()">Double-click me</button>

<p id="demo"></p>

<p>A function is triggered when the button is double-clicked. The function outputs some text in a p element with id="demo".</p>

<script>
function myFunction() {
  document.getElementById("demo").innerHTML = "Hello World";
}
</script>

</body>
</html>
How to Execute a JavaScript when a button is double-clicked




Type:
html
Category:
Web Tutorial
Sub Category:
HTML Mouse Events Attribute
Uploaded by:
Admin