jQuery dblclick Event

Beginner
6 min read
Updated: Oct 2026
5 examples
Live preview

What Is the dblclick Event?

dblclick is sent when an element is double-clicked. Bind it with .on("dblclick", handler) (jQuery 1.7+). Any HTML element can receive it.

Remember
$("#target").on("dblclick", function () { ... })
$("#target").trigger("dblclick")

// Needs two clicks inside the element
// (down → up → down → up, within the OS window)
// Prefer on/trigger — not the deprecated .dblclick()
NeedUse
Bind handler.on("dblclick", handler)
Fire event.trigger("dblclick")
Delegation.on("dblclick", "li", handler)
Single clickclick

How to Use dblclick

Select an element, bind with .on, optionally trigger from code.

  1. Select the element(s): $("#box"), $("p"), etc.
  2. Bind: .on("dblclick", function (event) { ... }).
  3. Double-click the element (or call .trigger("dblclick")).
  4. Unbind with .off("dblclick") when needed.
PieceRequired?Role
"dblclick"YesEvent type string for .on / .trigger
handlerYes (bind)Runs on each double-click
eventDataOptionalExtra data passed into the handler
Return value—jQuery set (chainable)

Pseudocode

Pseudocode
function onDblclick(element, handler):
    when press + release inside element
     and press + release again inside element
     within the system double-click window:
        handler(event)

trigger(element, "dblclick"):
    run all dblclick handlers on element

Cheat Sheet

Keep these facts handy while wiring double-click handlers.

TopicDetail
Bind.on("dblclick", handler) (1.7+)
Trigger.trigger("dblclick") (1.0+)
SequenceTwo clicks inside the element (OS timing)
Delegation.on("dblclick", childSelector, fn)
Unbind.off("dblclick")
Deprecated.dblclick() shorthand (3.3+)
AvoidBoth click and dblclick on one element

Live Preview

Run presets that use .on("dblclick") and .trigger("dblclick") (simulated with trigger so you can click once).

Uses .on("dblclick") and .trigger("dblclick") — same ideas as the examples below.

Result
Handler for dblclick called.

jQuery Examples

Short, copy-ready snippets. Open DevTools Console, or use Try It Yourself for a live editor.

Example 1 — Bind a Double-Click Handler

Official style: .on("dblclick", …) on a target element.

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

How It Works

  1. Select #target.
  2. Bind with .on("dblclick", handler).
  3. User double-clicks inside the element.
  4. Handler runs once per completed double-click.

Example 2 — Trigger dblclick from Code

Fire the same handlers with a single click on another control.

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

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

How It Works

  1. Bind the real handler on #target.
  2. Another control listens for a normal click.
  3. trigger("dblclick") runs #target’s dblclick handlers.
  4. Same message as a real double-click on #target.

Example 3 — Hello World on Paragraphs

Official demo idea: double-click any paragraph to log a greeting.

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

How It Works

  1. Bind dblclick on every p.
  2. Double-click a paragraph.
  3. Handler runs for that paragraph.
  4. Message prints once per double-click.

Example 4 — Toggle Text on Double-Click

Official toggle idea, kept CSS-free: swap the label text.

jQuery
var $box = $("#block");

$box.on("dblclick", function () {
  if ($box.text() === "OFF") {
    $box.text("ON");
  } else {
    $box.text("OFF");
  }
});
Try It Yourself

How It Works

  1. Cache the target with $("#block").
  2. On dblclick, read the current text.
  3. Swap between ON and OFF.
  4. Each double-click flips the state once.

Example 5 — Event Delegation

One parent handler covers current and future children.

jQuery
$("#list").on("dblclick", "li", function () {
  console.log("Edit: " + $(this).text());
});

// Later…
$("#list").append("<li>New file</li>");
// New file is double-clickable too — no extra bind
Try It Yourself

How It Works

  1. Bind on parent #list, filter with "li".
  2. Double-click bubbles from the li to the list.
  3. this is the matched li.
  4. New items work automatically after append.

Edge Cases & Pitfalls

Watch these when relying on double-click handlers.

deprecated

Avoid .dblclick() shorthand

Deprecated in 3.3. Use .on("dblclick") / .trigger("dblclick") / .off("dblclick").

conflict

Don’t mix click + dblclick casually

Some browsers fire one click before dblclick; others fire two. Pick one gesture, or delay the click and cancel on dblclick.

timing

Double-click window varies

Max time between clicks is OS- and browser-dependent (and often user-configurable). Don’t hard-code a fragile interval.

pointer

Pointer must stay inside

All four steps (down/up/down/up) need the pointer inside the element. Leaving mid-gesture can cancel dblclick.

dynamic

New DOM nodes need delegation

Binding only existing elements misses later inserts. Prefer .on("dblclick", "child", fn) on a stable parent.

Browser Support

The native dblclick event works in all browsers. Bind with .on("dblclick") since jQuery 1.7; .trigger("dblclick") since 1.0. Prefer these over the deprecated .dblclick() shorthand (3.3+).

✓ jQuery 1.7+ (.on)

dblclick event

Supported everywhere jQuery event APIs run in the browser. Use on/trigger for modern code.

100% Browser support
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
on("dblclick") Excellent

Bottom line: Bind with .on("dblclick", fn). Trigger with .trigger("dblclick"). Avoid binding both click and dblclick on the same element.

Performance Notes

ApproachCostBest for
Direct .on("dblclick")1 handler / elementFew static controls
Delegated .on1 handler / parentLists / tables / dynamic UI
click + dblclick timersExtra timersOnly when both gestures are required

Delegation scales better than binding hundreds of individual handlers. If you must support both click and dblclick, keep the delay short and clear timers promptly to avoid leaked timeouts.

Key Takeaways

  • Bind: .on("dblclick", handler) — not deprecated .dblclick().
  • Fire: .trigger("dblclick") for programmatic double-clicks.
  • Sequence: two clicks inside the element within the OS window.
  • Conflict: avoid binding both click and dblclick on one element.

One line: use .on("dblclick", fn) to listen and .trigger("dblclick") to fire — prefer that over the deprecated .dblclick() shorthand.

Frequently Asked Questions

dblclick fires when the user double-clicks an element — two full click gestures inside the element within a system-dependent time window. Bind with .on("dblclick", handler) (jQuery 1.7+). Any HTML element can receive it.
Prefer .on("dblclick", handler). The .dblclick(handler) shorthand is deprecated since jQuery 3.3. To fire the event, use .trigger("dblclick") instead of .dblclick().
click is one press+release inside the element. dblclick needs two complete click cycles (down, up, down, up) inside the element within the OS double-click interval.
The jQuery API advises against it. Browsers differ on how many click events fire before dblclick. Prefer one gesture per action, separate elements, or a short click-delay pattern that cancels when dblclick runs.
Call $(selector).trigger("dblclick"). That runs bound dblclick handlers. A common demo: single-click one control to trigger("dblclick") on another.
Per the API: mousedown inside, mouseup inside, mousedown again inside (within the double-click window), then mouseup inside. The max gap between clicks is OS- and browser-dependent.

Next: .dblclick() shorthand

See the deprecated helper and how it maps to on / trigger.

.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.

9 people found this page helpful