Home >>jQuery Tutorial >jQuery dblclick() Events

jQuery dblclick() Events

jQuery dblclick() Events

jQuery dblclick() Events is used to triggers the dblclick event, or when a double-clicked event occurs it attaches a function to run.

Syntax:
Trigger the dblclick event for the selected elements: $(selector).dblclick()
Attach a function to the dblclick event: $(selector).dblclick(function)

Parameter Values

Parameter Description
function It is Optional parameter and is used to Specifies when the double click event occurs the function to run
Here is an Example of jQuery dblclick() Event:

<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$(".btn1").dblclick(function(){
alert("The button was double-clicked.");
});
});
</script>
</head>
<body>
<button class="btn1">Double-click</button>
</body>
</html>

Output: