Last Updated : 26 Nov, 2024
The HTML DOM ondblclick event occurs on a double click by the user.
In HTML:
<element ondblclick="myScript">HTML
<!DOCTYPE html>
<html>
<body>
<button id="demo" ondblclick="myFunction()">
Double-click
</button>
<script>
function myFunction() {
alert("Double click")
}
</script>
</body>
</html>
In JavaScript:
object.ondblclick = function(){myScript};HTML
<!DOCTYPE html>
<html>
<body>
<button id="demo">
Double-click
</button>
<script>
document.getElementById(
"demo").ondblclick = function () {
GFGfun()
};
function GFGfun() {
alert("double click")
}
</script>
</body>
</html>
In JavaScript, using the addEventListener() method:
object.addEventListener("dblclick", myScript);HTML
<!DOCTYPE html>
<html>
<body>
<button id="demo">
Double-click
</button>
<script>
document.getElementById("demo").addEventListener("dblclick", GFGfun);
function GFGfun() { alert("double click") }
</script>
</body>
</html>
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4