Prev Demo
JavaScript
>
How To Execute A Function When An Element Is Double Clicked In Javascript?
Next Demo
Write code here
J
|
B
|
A
<!DOCTYPE html> <html> <head> <title>Demo</title> </head> <body> <h1>Ondblclick</h1> Enter your name: <input type="text" name="txtName" id="txtName" /> <input type="button" id="btn" name="btn" value="Submit" ondblclick="CallFunction(this.id)" /> <script> function CallFunction(id) { alert("Double clicked"); } </script> <p><strong>Note:</strong> Double click the button to get the alert.</p> </body> </html>
Note: We DO NOT save your trial code in our database.
Output