Computers & ProgrammingFrontend DevelopmentjQuery

jQuery Dblclick Event

The jQuery event dblclick() method occurs when an element is double-clicked. The dblclick() method triggers the dblclick event, or specifies a function to run when a dblclick event occurs.

You should note that it is not recommended to apply the click and dblclick event to the same element. If both are applied, unexpected results can occur.

Syntax

$(selector).dblclick()
$(selector).dblclick(function)
ParameterDescription
functionFunction to run when the event(s) occur

Basic Example

In the following jQuery example, the dblclick() method specifies that a function should run when the click event occurs. In this example, the div element will be shown or hidden as the mouse icon is double-clicked. You can copy and edit the jQuery code using our online HTML editor.

$("#mouse").dblclick(function () {
    $("#div1").slideToggle();
});

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top