jQuery double click | How to use mouse dblclick() event method in jQuery

What is the jQuery double click() method

The double click event occurs when an element of HTML document is clicked.

How to use it?

Following is the general syntax of using the double click method:

$(selector).dblclick(function)

Where the function is optional. It runs as the double click event occurs.

e.g.

$(“p”).dblclick(function)

$(“div”).dblclick(function)

$(“button”).dblclick(function)

Below are running examples of the dblclick() method with different HTML elements

Example of dblclick() with Paragraph

In the following example, as the first paragraph is clicked it will trigger an event handler that will show an alert. The click method is attached with the clickme id.

Copy and paste code into HTML file and run in your browser.

jQuery dblclick

Experience this example online



Example of dblclick() with Div <div>

In this example, the div tags are used. As you double click the div tag, the alert will display which is associated with the dblclick() method of jQuery.

Experience this example online



You may also like: jQuery click


Was this article helpful?

Related Articles

Leave A Comment?