jQuery Double-Click Event

The double-click event runs after two rapid clicks on the same element. In current jQuery code, attach it with .on("dblclick", handler).

Syntax Top ↑

$( "element" ).on( "dblclick", function (event) {
    // Double-click code.
});

Double-Click a Button Top ↑

$( function () {
    $( "#b1" ).on( "dblclick", function () {
        $( "#t1" ).text( "You double-clicked the button" );
    });
});

Open the double-click demo →

One Double-Click Handler for a Class Top ↑

$( ".edit_class" ).on( "dblclick", function () {
    // Handle any matching record.
});

Read the ID of the Double-Clicked Element Top ↑

$( ".edit_class" ).on( "dblclick", function () {
    const id = this.id;
    console.log( "Double-clicked ID:", id );
});

Listen for Click and Double-Click Top ↑

$( "#b1" ).on( "click dblclick", function () {
    // Runs for either click type.
});
$( "#b1" ).on( "click dblclick", function (event) {
    $( "#t1" ).text( "Event type: " + event.type );
});

When single-click and double-click trigger different actions, test the interaction carefully because the browser may deliver click events as part of a double-click sequence.

Mouse Events with jQuery

← Click event · Events pillar






plus2net.com






✖
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
© 2000-2026 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer