jQuery Dblclick Event

Beginner
⏱️ 10 min read
📚 Updated: Jul 2026
🎯 5 Examples
🚀 5 Try-it labs
Mouse events

What You’ll Learn

The dblclick event fires when the user double-clicks an element — two full click gestures within a short time window. This tutorial covers binding with .on("dblclick"), passing eventData, triggering with .trigger("dblclick"), the four-step mouse sequence that produces a double-click, and why you should avoid binding both click and dblclick on the same node.

01

.on()

Bind handler

02

2× click

Double gesture

03

.trigger()

Fire event

04

vs click

Conflict risk

05

Delegate

Dynamic lists

06

Since 1.7

Modern API

Introduction

Single clicks handle everyday actions — select, submit, navigate. Double-clicks unlock a second tier: rename a file, open a document, zoom a map, or edit inline text. jQuery’s dblclick event lets your code respond when the user completes that faster two-click gesture on any HTML element.

The official jQuery API distinguishes the dblclick event (bound with .on("dblclick") since 1.7) from the deprecated .dblclick() method. To fire a handler programmatically, use .trigger("dblclick") — available since jQuery 1.0.

Understanding the dblclick Event

The dblclick event is sent to an element when the pointer is over it and the user performs two complete click cycles — press, release, press again, release again — all inside the element and within the operating system’s double-click time limit. jQuery normalizes this across browsers and supplies an event object with event.target, coordinates, and standard methods.

The jQuery documentation warns that binding handlers to both click and dblclick on the same element is inadvisable. Browser behavior varies: some emit two click events before dblclick, others one. Double-click sensitivity also differs by OS, browser, and user settings.

💡
Beginner Tip

Need single-click and double-click on one element? Use a delayed click handler (e.g. 300 ms) and cancel the timer when dblclick fires — or put each gesture on a different element. See Example 5 for a practical pattern.

📝 Syntax

The modern jQuery API for the dblclick event has two main forms — binding a handler and triggering the event:

1. Bind a handler — .on("dblclick" [, eventData ], handler) (since 1.7)

jQuery
.on( "dblclick" [, eventData ], handler )
  • eventData — optional object passed to the handler as event.data.
  • handler — function called each time dblclick fires: function( event ) { ... }.

2. Event delegation — .on("dblclick", selector, handler)

jQuery
$( "#list" ).on( "dblclick", "li", function( event ) {
  // runs when any li inside #list is double-clicked
} );

3. Trigger the event — .trigger("dblclick") (since 1.0)

jQuery
.trigger( "dblclick" )
  • Runs bound dblclick handlers programmatically.
  • Use .triggerHandler("dblclick") to run handlers without bubbling side effects.

4. Unbind — .off("dblclick" [, selector] [, handler])

jQuery
$( "#target" ).off( "dblclick" );           // remove all dblclick handlers
$( "#list" ).off( "dblclick", "li", fn );   // remove delegated handler

Official jQuery API example

jQuery
$( "#target" ).on( "dblclick", function() {
  alert( "Handler for `dblclick` called." );
} );

$( "#other" ).on( "click", function() {
  $( "#target" ).trigger( "dblclick" );
} );

Return value

  • .on() and .trigger() return the original jQuery object for chaining.
  • Handler return values are ignored unless you use return false (equivalent to preventDefault() + stopPropagation()).

⚡ Quick Reference

GoalCode
Bind dblclick handler$("#box").on("dblclick", fn)
Pass data to handler$("#box").on("dblclick", { id: 1 }, fn)
Delegated dblclick on children$("#list").on("dblclick", "li", fn)
Trigger dblclick programmatically$("#target").trigger("dblclick")
Proxy trigger from click$("#btn").on("click", function(){ $("#target").trigger("dblclick"); })
Remove dblclick handlers$("#box").off("dblclick")
One-time dblclick$("#box").one("dblclick", fn)

📋 dblclick vs click vs deprecated .dblclick()

Three related APIs — know which handles a single click, which handles a double-click, and which to avoid in new code.

dblclick
2× down+up

Two full click cycles inside element — rename, zoom, inline edit

click
1× down+up

Single press-and-release — select, submit, toggle

Both on same node
risky

Extra click events before dblclick — use delay pattern instead

.dblclick() method
deprecated

Old binding shorthand — use .on("dblclick") instead

Examples Gallery

Examples 1–4 follow the official jQuery API documentation. Example 5 shows delegated double-click on a list and a safe click+dblclick delay pattern. Use the Try-it links — double-click inside the demo area to test.

📚 Binding & Triggering

Official jQuery demos for dblclick handlers and programmatic triggers.

Example 1 — Official Demo: Bind Handler on #target

Alert when the user double-clicks the target element — the canonical .on("dblclick") pattern.

jQuery
$( "#target" ).on( "dblclick", function() {
  alert( "Handler for `dblclick` called." );
} );
Try It Yourself

How It Works

.on("dblclick", fn) registers the function on the element. jQuery calls it only after the browser detects a complete double-click — four steps: down, up, down, up, all inside #target.

Example 2 — Official Demo: #other Triggers Dblclick on #target

A single click on one element programmatically fires the dblclick handler on another.

jQuery
$( "#target" ).on( "dblclick", function() {
  alert( "Handler for `dblclick` called." );
} );

$( "#other" ).on( "click", function() {
  $( "#target" ).trigger( "dblclick" );
} );
Try It Yourself

How It Works

.trigger("dblclick") synthetically fires the dblclick event on #target, running the same handler as a physical double-click. The official demo wires a proxy button for accessibility or testing.

Example 3 — Official Demo: “Hello World!” on Paragraphs

Show an alert when the user double-clicks any paragraph on the page.

jQuery
$( "p" ).on( "dblclick", function() {
  alert( "Hello World!" );
} );
Try It Yourself

How It Works

Binding to all p elements attaches one handler per paragraph. Double-clicking any of them runs the alert — the simplest way to verify dblclick is wired correctly.

Example 4 — Official Demo: Double-Click to Toggle Background Color

Toggle a highlight class when the user double-clicks a block.

jQuery
var divdbl = $( "div" ).first();

divdbl.on( "dblclick", function() {
  divdbl.toggleClass( "dbl" );
} );
Try It Yourself

How It Works

.toggleClass("dbl") adds or removes the class on each double-click. CSS switches from blue to yellow. This mirrors the official jQuery API demo.

📈 Delegation & Click Conflict

Handle double-clicks on dynamic items and avoid click+dblclick clashes.

Example 5 — Delegated Dblclick with Click-Delay Pattern

Single-click selects a list item; double-click opens edit mode — using delegation and a timer so both gestures coexist safely.

jQuery
var clickTimer = null;

$( "#list" ).on( "click", "li", function() {
  var el = this;
  clearTimeout( clickTimer );
  clickTimer = setTimeout( function() {
    $( el ).addClass( "selected" ).siblings().removeClass( "selected" );
    $( "#out" ).text( "Selected: " + $( el ).text() );
  }, 300 );
} );

$( "#list" ).on( "dblclick", "li", function() {
  clearTimeout( clickTimer );
  $( "#out" ).text( "Edit mode: " + $( this ).text() );
  $( this ).addClass( "editing" );
} );
Try It Yourself

How It Works

The click handler waits 300 ms before acting — if a dblclick arrives first, clearTimeout cancels the pending select. This is the standard pattern recommended when you need both gestures on the same element, instead of naively binding both without delay.

🚀 Common Use Cases

  • Inline rename — double-click a file or folder name to switch to an input field.
  • Text selection expand — double-click a word to select it in editors and document viewers.
  • Map zoom — double-click to zoom in on a geographic point.
  • Table row edit — delegated $("#grid").on("dblclick", "tr", fn) for spreadsheet-style UIs.
  • Proxy triggers$("#shortcut").on("click", function(){ $("#doc").trigger("dblclick"); }) for keyboard-accessible alternatives.
  • EventData labels$(".tile").on("dblclick", { action: "open" }, fn) to pass metadata without closures.

🧠 How the dblclick Event Flows

1

First click cycle

User presses and releases inside the element — first mousedown, mouseup, and click fire.

Click 1
2

Second click cycle

User presses and releases again inside the same element — within the OS double-click time window.

Click 2
3

dblclick fires

Browser sends dblclick — jQuery runs bound handlers via the event system.

dblclick
4

Handler runs

Your function executes — watch for extra click events if you also bind click on the same node.

📝 Notes

  • Bind with .on("dblclick", handler) since jQuery 1.7 — not the deprecated .dblclick(handler) shorthand.
  • Trigger with .trigger("dblclick") since jQuery 1.0.
  • Avoid binding both click and dblclick on the same element without a delay pattern — browser click counts vary.
  • Double-click sensitivity is OS-, browser-, and often user-configurable — do not hard-code exact millisecond values for all users.
  • Any HTML element can receive the dblclick event — not limited to buttons or links.
  • Use .off("dblclick") to remove handlers — avoid deprecated .unbind("dblclick").
  • Touch devices may not fire dblclick reliably — provide alternative gestures for mobile users.

Browser Support

The dblclick event is a standard DOM event supported in every browser jQuery targets. jQuery’s .on("dblclick") (since 1.7) and .trigger("dblclick") (since 1.0) normalize cross-browser behavior.

jQuery 1.7+

jQuery dblclick event

Supported in jQuery 1.x, 2.x, and 3.x across all modern browsers and IE with supported jQuery versions. Native equivalent: element.addEventListener('dblclick', fn). Click+dblclick interaction timing varies by browser — test your delay pattern.

100% With jQuery loaded
Google Chrome All versions · Desktop & Mobile
Full support
Mozilla Firefox All versions · Desktop & Mobile
Full support
Apple Safari All versions · macOS & iOS
Full support
Microsoft Edge All versions · Chromium & Legacy
Full support
Internet Explorer IE 6+ · Legacy environments
Full support
Opera All modern versions
Full support
dblclick Universal

Bottom line: Safe in any jQuery project. Prefer .on('dblclick') over deprecated .dblclick() for binding. Use delegation for dynamic lists and a click-delay when both gestures share one element.

Conclusion

The jQuery dblclick event responds when the user completes two full click cycles inside an element. Bind handlers with .on("dblclick", fn), pass optional eventData, and fire handlers programmatically with .trigger("dblclick").

Remember the official four-step sequence and the warning about binding both click and dblclick naively on the same node. Use a click-delay timer or delegation when you need select-on-click and edit-on-double-click. For single-click patterns, see the jQuery click event tutorial.

💡 Best Practices

✅ Do

  • Bind with .on("dblclick", handler) — the modern, delegation-capable API
  • Use event delegation for dynamic lists: .on("dblclick", "li", fn)
  • Use a click-delay timer when single- and double-click share one element
  • Call .off("dblclick") when removing elements or tearing down SPAs
  • Provide keyboard or button alternatives to double-click actions

❌ Don’t

  • Bind click and dblclick on the same node without a delay pattern
  • Use deprecated .dblclick(handler) in new code — use .on("dblclick")
  • Assume double-click works identically on touch devices
  • Hard-code one global double-click timeout for all operating systems
  • Confuse dblclick with two rapid .trigger("click") calls — use .trigger("dblclick")

Key Takeaways

Knowledge Unlocked

Six things to remember about the dblclick event

Bind, trigger, avoid conflicts.

6
Core concepts
02

Two clicks

Full cycles

Gesture
03

.trigger()

Fire

Programmatic
! 04

vs click

Conflict

Pitfall
li 05

Delegate

Dynamic

Pattern
.off 06

.off("dblclick")

Unbind

Cleanup

❓ Frequently Asked Questions

The dblclick event fires when the user double-clicks an element — two full click gestures within a system-dependent time window. Bind handlers with .on('dblclick', handler) since jQuery 1.7. Any HTML element can receive this event.
click fires on a single press-and-release inside an element. dblclick fires only after two complete click cycles (down, up, down, up) both inside the same element within the OS double-click interval. They are separate events — but binding both on the same element can cause unpredictable extra click events.
The jQuery API advises against it. Browsers differ: some fire two click events before dblclick, others one. Use a click-delay timer pattern, separate elements, or choose one gesture per action. If you need single-click select and double-click edit, delay the click handler ~300ms and cancel it when dblclick fires.
Call .trigger('dblclick') on the target: $('#target').trigger('dblclick'). Available since jQuery 1.0, this runs bound dblclick handlers. The official demo uses a single click on #other to trigger dblclick on #target.
Use .on('dblclick', handler) for binding — the modern API since jQuery 1.7. The old .dblclick(handler) shorthand is deprecated since 3.3 like .click(handler). For triggering, prefer .trigger('dblclick') over no-arg .dblclick().
Per the jQuery API: mousedown inside, mouseup inside, mousedown again inside (within the double-click window), then mouseup inside. All four steps must occur with the pointer inside the element. The maximum time between clicks is OS- and browser-dependent and often user-configurable.
Did you know?

The jQuery API explicitly lists the four mouse steps that produce a dblclick: mousedown, mouseup, mousedown again, mouseup again — all with the pointer inside the element. If the user moves outside between clicks, the double-click is cancelled. The maximum gap between the two clicks is controlled by the operating system, not jQuery.

Next: .dblclick() Method

Learn the deprecated shorthand — and how to migrate to .on("dblclick").

.dblclick() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

6 people found this page helpful