jQuery dblclick Event

Beginner
5 min read
Updated: Nov 2026
3 examples
Mouse Events

Definition

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

Syntax

Start with these common calls. Keep them short and readable.

jQuery
$("#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()
CallWhat it does
dblclickLearn the jQuery dblclick event: bind with .on(\

Load jQuery before your script (CDN or local file), then wrap DOM work in $(function () { ... }) when needed.

Parameters

ParameterDescription
Step 1Select the element(s): $("#box"), $("p"), etc.
Step 2Bind: .on("dblclick", function (event) { ... }).
Step 3Double-click the element (or call .trigger("dblclick")).

Return Value

Return ValueDescription
jQuery objectMost setters and traversing helpers return the jQuery collection so you can chain more methods.

jQuery Examples

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.

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.

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.

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() Method — Deprecated Shorthand

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

.dblclick() Method — Deprecated Shorthand tutorial →

CODETOFUN NEWS

Stay Ahead in Tech

Get the latest IT news, programming updates, and technology trends directly on your phone.

Your daily dose of tech, straight to your feed.

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