jQuery dblclick() Method
jQuery dblclick() method trigger the double click event. The jQuery dblclick event occurs when an element is double clicked. And when the double click event occurs, specified function will execute.
Syntax
This syntax represent to the double click event trigger
$(selector).dblclick(); // This syntax does not accept any arguments.
and this syntax represent to attach a function to the double click event
$(selector).dblclick(function);
Parameter | Type | Description |
---|---|---|
function | Function | Optional. Specifies the function to execute when the double click event is occurs. |
Examples
This example represent to the double click event trigger on the selected elements.
$(document).ready(function(){
$("button").click(function(){
$("p").dblclick();
});
$("p").dblclick(function(){
$("span").fadeIn(500);
$("span").fadeOut(500);
});
});
This example represent to attach a function to the double click event.
$(document).ready(function(){
$("p").dblclick(function(){
$("span").fadeIn(500);
$("span").fadeOut(500);
});
});