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
Fundamentals
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 dblclickevent (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.
Concept
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 bothclick 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.
Foundation
📝 Syntax
The modern jQuery API for the dblclick event has two main forms — binding a handler and triggering the event:
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
Hands-On
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.
User double-clicks #target → alert: "Handler for dblclick called."
Single clicks do not fire this handler
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.
.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.
Double-click any paragraph → alert: "Hello World!"
Each p element has its own handler via the shared selector
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.
Single-click li → after 300ms → .selected, log "Selected: …"
Double-click li → cancels click timer → .editing, log "Edit mode: …"
Delegation covers items added later via .append()
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.
Applications
🚀 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.
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.
Important
📝 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.
Compatibility
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 ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
dblclickUniversal
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.
Wrap Up
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.
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")
Summary
Key Takeaways
Knowledge Unlocked
Six things to remember about the dblclick event
Bind, trigger, avoid conflicts.
6
Core concepts
.on01
.on("dblclick")
Bind
API
2×02
Two clicks
Full cycles
Gesture
⚡03
.trigger()
Fire
Programmatic
!04
vs click
Conflict
Pitfall
li05
Delegate
Dynamic
Pattern
.off06
.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.