.dblclick()

The .dblclick() method attaches an event handler to the "dblclick" event of an HTML element.

Syntax

$(selector).dblclick(handler);

A handler function will be assigned to the "double-click" event of the HTML element(s) specified by selector.

Example

The following jQuery code will spawn a message box every time a paragraph in the document is double-clicked:

$("p").dblclick(function() {
alert("Paragraph double-clicked!");
});

Contributors

Interested in helping build Docs? Read the Contribution Guide or share your thoughts in this feedback form.

Learn JavaScript on Codecademy