double click event in javascript code example
Example 1: javascript on double click
document.getElementById("myBtn").addEventListener("dblclick", function() {
alert("Hello World!");
});
Example 2: how to open a new html page on button click in javascript
<button id="myButton" class="float-left submit-button" >Home</button>
<script type="text/javascript">
document.getElementById("myButton").onclick = function () {
location.href = "www.yoursite.com";
};
</script>
Example 3: double click on element using javascript
document.getElementById("something").dblclick();
Example 4: javascript listen for double click
const div = document.querySelector('div');
div.addEventListener('dblclick', () => {
alert('You just double clicked the div!');
});