Javascript examples for jQuery Method and Property:dblclick
The dblclick() method triggers the dblclick event, or sets function as dblclick event handler.
$(selector).dblclick(function);
Parameter | Description |
---|---|
function | Optional. Specifies the function to run when the dblclick event occurs |
The following code shows how to handle Double-click event on a <p> element.
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("p").dblclick(function(){ console.log("The paragraph was double-clicked."); });//w w w . j av a 2 s.com }); </script> </head> <body> <p>Double-click on this paragraph.</p> </body> </html>