jQuery .mousedown() Method

Beginner
⚠️ Deprecated since 3.3
⏱️ 11 min read
📚 Updated: Jul 2026
🎯 5 Examples
🚀 5 Try-it labs
Mouse events

What You’ll Learn

The .mousedown() method is jQuery’s legacy shorthand for binding and triggering the mousedown event. This tutorial covers .mousedown(handler) since 1.0, .mousedown(eventData, handler) since 1.4.3, no-argument .mousedown() as a trigger, migration to .on("mousedown") and .trigger("mousedown"), and why the binding form is deprecated since jQuery 3.3. For the modern mousedown event API, see the jQuery mousedown event tutorial.

01

.mousedown(fn)

Bind handler

02

eventData

Since 1.4.3

03

.mousedown()

Trigger event

04

.on()

Modern bind

05

.trigger()

Modern fire

06

Deprecated

Since 3.3

Introduction

Before jQuery 1.7 unified events with .on() and .off(), every common event had a matching shorthand — .click(), .mousedown(), .keydown(), and dozens more. The .mousedown() method let you bind a handler in one short call: $("#handle").mousedown(function(){ ... }). It remains in jQuery 3.x for backward compatibility but is marked deprecated.

Understanding .mousedown() matters when reading older drag-and-drop code, drawing tools, and legacy tutorials. The method does two distinct jobs: with a function argument it binds; with no arguments it triggers. Modern jQuery splits those roles explicitly — .on("mousedown", handler) for binding and .trigger("mousedown") for firing. This page documents the shorthand API and shows how to migrate.

Understanding the .mousedown() Method

The official jQuery API describes .mousedown() as a way to bind an event handler to the mousedown event, or trigger that event on an element. When you pass a handler, jQuery registers it on each matched element and calls it when the user presses a mouse button while the pointer is over that element — the same mousedown event that .on("mousedown") handles today.

When you call .mousedown() with no arguments, jQuery synthetically fires the mousedown event on each matched element. Bound handlers run immediately. This trigger behavior is equivalent to .trigger("mousedown").

⚠️
Deprecated since jQuery 3.3

Do not use .mousedown(handler) or .mousedown(eventData, handler) in new code. Replace them with .on("mousedown", handler) or .on("mousedown", eventData, handler). Replace no-argument .mousedown() with .trigger("mousedown"). For delegation, event.which, and comparison with click, read the jQuery mousedown event tutorial.

📝 Syntax

The .mousedown() method has three signatures from the official jQuery API. The binding forms are deprecated; the trigger form remains valid but .trigger("mousedown") is preferred:

1. Bind a handler — .mousedown( handler ) (since 1.0, deprecated 3.3)

jQuery
.mousedown( handler )
  • handler — function executed each time mousedown fires: function( event ) { ... }.
  • Returns the jQuery object for chaining.
  • Modern replacement: .on( "mousedown", handler ).

2. Bind with eventData — .mousedown( [eventData], handler ) (since 1.4.3, deprecated 3.3)

jQuery
.mousedown( [eventData], handler )
  • eventData — optional object available in the handler as event.data.
  • Modern replacement: .on( "mousedown", eventData, handler ).

3. Trigger the event — .mousedown() (since 1.0)

jQuery
.mousedown()
  • No arguments — triggers mousedown on every matched element.
  • Runs bound mousedown handlers.
  • Preferred replacement: .trigger( "mousedown" ).

Official jQuery API migration note

jQuery
// Deprecated binding
$( "#target" ).mousedown( function() {
  alert( "Handler for `mousedown` called." );
} );

// Modern binding
$( "#target" ).on( "mousedown", function() {
  alert( "Handler for `mousedown` called." );
} );

// Deprecated trigger
$( "#target" ).mousedown();

// Modern trigger
$( "#target" ).trigger( "mousedown" );

Return value

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

⚡ Quick Reference

GoalLegacy (.mousedown)Modern replacement
Bind mousedown handler$("#box").mousedown(fn)$("#box").on("mousedown", fn)
Pass data to handler$("#box").mousedown({ tool: "pen" }, fn)$("#box").on("mousedown", { tool: "pen" }, fn)
Left button onlyif (event.which !== 1) return; — works in both APIs
Trigger mousedown programmatically$("#target").mousedown()$("#target").trigger("mousedown")
Remove mousedown handlers$("#box").off("mousedown")
Delegated mousedown on children$("#panel").on("mousedown", ".handle", fn) — not available via .mousedown()
One-time mousedown$("#box").one("mousedown", fn) — use .one(), not .mousedown()

📋 .mousedown() vs .on("mousedown") vs .trigger("mousedown") vs .off("mousedown")

Four related APIs — know which one binds, which one fires, and which one removes handlers.

.mousedown()
deprecated

Legacy bind (.mousedown(fn)) or trigger (.mousedown()) — use modern APIs for new code

.on("mousedown")
bind

Modern binding since 1.7 — supports eventData and delegation on dynamic content

.trigger("mousedown")
fire

Programmatically run handlers — clearer than no-arg .mousedown()

.off("mousedown")
remove

Unbind handlers — pair with .on("mousedown") when cleaning up or in SPAs

Examples Gallery

Five examples cover binding, eventData, triggering, migration from .mousedown() to .on("mousedown"), and press-time active states. Use the Try-it links to run each snippet in the browser. Remember: binding with .mousedown(handler) is deprecated — these demos show legacy syntax you will encounter in older code.

📚 Binding & Triggering

Legacy .mousedown() signatures for binding handlers and firing events programmatically.

Example 1 — Bind Handler with .mousedown(handler)

The canonical legacy pattern — attach a function that runs when the user presses the mouse button on the element.

jQuery
$( "#target" ).mousedown( function() {
  $( "#out" ).text( "Handler ran via .mousedown(function(){ ... })." );
} );
Try It Yourself

How It Works

.mousedown(fn) registers the function on the element. jQuery internally routes this to .on("mousedown", fn). The handler runs the instant the button is pressed — not after release like click.

Example 2 — Pass eventData with .mousedown(eventData, handler)

Since jQuery 1.4.3, pass an object before the handler — it arrives as event.data.

jQuery
$( ".tool" ).mousedown( { mode: "draw" }, function( event ) {
  var tool = $( this ).data( "tool" );
  $( "#out" ).text(
    "Tool: " + tool + " | eventData.mode: " + event.data.mode
  );
} );
Try It Yourself

How It Works

jQuery stores the { mode: "draw" } object and injects it into event.data when any matched .tool is pressed. Use $(this).data("tool") for per-element attributes. Modern equivalent: .on("mousedown", { mode: "draw" }, fn).

Example 3 — Trigger mousedown with No-Argument .mousedown()

Calling .mousedown() without a handler fires the mousedown event programmatically.

jQuery
var count = 0;

$( "#target" ).mousedown( function() {
  count++;
  $( "#out" ).text( "Target handler fired (count: " + count + ")" );
} );

$( "#fire" ).click( function() {
  $( "#target" ).mousedown();
} );
Try It Yourself

How It Works

The first .mousedown(function(){ ... }) binds a handler on #target. The second binds on #fire and calls $("#target").mousedown() with no arguments — that synthetically fires mousedown. Replace with $("#target").trigger("mousedown") for clarity.

📈 Migration & Press-Time UI

Compare legacy and modern APIs, and use mousedown for instant press feedback.

Example 4 — Migration: .mousedown(fn) vs .on("mousedown", fn)

Both bind the same mousedown event — .on() is the recommended API for new code.

jQuery
$( "#legacy" ).mousedown( function() {
  $( "#out" ).text( "Legacy: .mousedown(function(){ ... }) — deprecated since jQuery 3.3." );
} );

$( "#modern" ).on( "mousedown", function() {
  $( "#out" ).text( "Modern: .on('mousedown', function(){ ... }) — use this for new code." );
} );
Try It Yourself

How It Works

Under the hood, .mousedown(fn) calls .on("mousedown", fn). Migration is a straight rename with no behavior change for simple bindings. The advantage of .on() is delegation — $("#panel").on("mousedown", ".handle", fn) — which .mousedown() cannot do.

Example 5 — Active State on Press with Chained .mousedown(handler)

.mousedown(handler) returns the jQuery object — add .active on press and remove on document mouseup.

jQuery
$( "#handle" )
  .mousedown( function( event ) {
    if ( event.which !== 1 ) return;
    $( this ).addClass( "active" );
    $( "#out" ).text( "Pressed — .active added via .mousedown()." );
    $( document ).one( "mouseup", function() {
      $( "#handle" ).removeClass( "active" );
      $( "#out" ).text( "Released — .active removed on mouseup." );
    } );
  } );
Try It Yourself

How It Works

This is a classic mousedown use case: instant visual feedback on press, cleanup on release. event.which !== 1 skips non-primary buttons. The same pattern works with .on("mousedown", fn) — preferred for new code.

🚀 Common Use Cases

  • Reading legacy code — recognize $("#handle").mousedown(fn) as equivalent to .on("mousedown", fn) in older drag libraries.
  • Drawing tools — legacy canvas code often uses .mousedown(fn) to start strokes — migrate to .on("mousedown", fn).
  • Proxy triggers$("#btn").click(function(){ $("#target").mousedown(); }) — replace inner no-arg .mousedown() with .trigger("mousedown").
  • Shared eventData$(".tool").mousedown({ mode: "draw" }, fn) passes metadata without closures.
  • Press feedback — add active classes on .mousedown(fn), remove on document mouseup.
  • Automated testing — test suites may call .mousedown() to simulate press — consider .trigger("mousedown") for explicit intent.

🧠 How .mousedown() Routes Through jQuery

1

You call .mousedown()

With a function argument, jQuery treats it as a bind request. With no arguments, it treats it as a trigger request.

dispatch
2

Bind path

.mousedown(handler) delegates internally to .on("mousedown", handler) — the handler is stored in jQuery’s event system.

.on("mousedown")
3

Trigger path

No-arg .mousedown() delegates to .trigger("mousedown") — bound handlers run on each matched element.

.trigger("mousedown")
4

jQuery object returned

Both paths return the original collection for chaining — .mousedown(fn).addClass("ready") works the same as .on("mousedown", fn).addClass("ready").

📝 Notes

  • Deprecated since jQuery 3.3 — do not use .mousedown(handler) or .mousedown(eventData, handler) in new code. Use .on("mousedown") instead.
  • Bind with .mousedown(handler) since jQuery 1.0; eventData form since 1.4.3.
  • No-argument .mousedown() triggers the event since jQuery 1.0 — prefer .trigger("mousedown").
  • .mousedown() does not support event delegation — use .on("mousedown", selector, fn) for dynamic handles.
  • Remove handlers with .off("mousedown") — not by calling .mousedown(undefined).
  • Legacy code using .mousedown() still runs in jQuery 3.x — migrate when you refactor those files.
  • For the full modern mousedown event guide — event.which, comparison with click, and drag patterns — see the jQuery mousedown event tutorial.

Browser Support

The underlying mousedown event is a standard DOM event supported in every browser jQuery targets. The .mousedown() method itself is a jQuery API — it works in jQuery 1.x, 2.x, and 3.x. Binding via .mousedown(handler) is deprecated since 3.3 but still functional; triggering via no-arg .mousedown() also remains supported.

jQuery 1.0+

jQuery .mousedown() method

Supported across all jQuery versions you are likely to maintain. Deprecated binding since 3.3 — use .on('mousedown') for new projects. Native equivalent for binding: element.addEventListener('mousedown', fn). Native equivalent for trigger: dispatchEvent with a MouseEvent.

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
.mousedown() Legacy API

Bottom line: Safe in legacy jQuery projects. Migrate bindings to .on('mousedown') and triggers to .trigger('mousedown') when updating code.

Conclusion

The jQuery .mousedown() method is the legacy shorthand for binding and triggering mousedown handlers. Use .mousedown(handler) or .mousedown(eventData, handler) to bind — both deprecated since jQuery 3.3. Use no-argument .mousedown() to trigger — equivalent to .trigger("mousedown").

For new code, prefer .on("mousedown", fn) for binding and .trigger("mousedown") for programmatic firing. When you encounter .mousedown() in older projects, recognize it, understand it, and migrate when practical. For delegation, event.which, and the complete modern mousedown workflow, continue with the jQuery mousedown event tutorial.

💡 Best Practices

✅ Do

  • Use .on("mousedown", handler) for all new mousedown bindings
  • Use .trigger("mousedown") instead of no-arg .mousedown()
  • Migrate .mousedown(fn) to .on("mousedown", fn) when refactoring legacy files
  • Check event.which === 1 before drag or primary-button actions
  • Read the modern mousedown event tutorial for delegation patterns

❌ Don’t

  • Write new code with deprecated .mousedown(handler)
  • Assume .mousedown() supports delegation — it does not
  • Confuse .mousedown(fn) (bind) with .mousedown() (trigger)
  • Use .unbind("mousedown") — it is also deprecated; use .off("mousedown")
  • Replace click with mousedown on buttons unless you need press-time behavior

Key Takeaways

Knowledge Unlocked

Six things to remember about .mousedown()

Legacy bind, modern migrate.

6
Core concepts
data 02

eventData

Since 1.4.3

Handler
() 03

.mousedown()

Trigger

No args
.on 04

.on("mousedown")

Modern

Replace
05

.trigger()

Fire

Programmatic
3.3 06

Deprecated

Since 3.3

Migrate

❓ Frequently Asked Questions

The .mousedown() method has two roles. With a handler argument — .mousedown(handler) or .mousedown(eventData, handler) — it binds a function that runs when the user presses a mouse button over the matched element. With no arguments — .mousedown() — it triggers the mousedown event on each matched element, running bound handlers. Both forms have been part of jQuery since 1.0; the binding form is deprecated since 3.3.
Yes — the binding signatures .mousedown(handler) and .mousedown(eventData, handler) are deprecated since jQuery 3.3. Use .on('mousedown', handler) or .on('mousedown', eventData, handler) instead. The no-argument .mousedown() trigger form still works but .trigger('mousedown') is clearer and preferred in modern code. Existing legacy code continues to run in jQuery 3.x; migrate when you touch those files.
.mousedown(handler) registers a callback — it does not fire the event immediately. .mousedown() with no arguments triggers the mousedown event programmatically on every matched element, the same as .trigger('mousedown'). The handler form is deprecated for binding; the no-arg form is a trigger shorthand. Always check whether parentheses contain a function before reading legacy jQuery code.
Replace .mousedown(fn) with .on('mousedown', fn). Replace .mousedown(data, fn) with .on('mousedown', data, fn). Replace no-arg .mousedown() with .trigger('mousedown'). Replace .unbind('mousedown') cleanup with .off('mousedown'). Under the hood, .mousedown(handler) already delegates to .on('mousedown') — migration is a straight rename with no behavior change for simple bindings.
Yes. jQuery 3.x keeps .mousedown() for backward compatibility with jQuery 1.x and 2.x codebases. It still binds and triggers correctly. The API docs mark it deprecated to steer new projects toward .on() and .trigger(). Do not use .mousedown(handler) in new code — prefer the modern API covered in the jQuery mousedown event tutorial.
Since jQuery 1.4.3, you can pass an object as the first argument before the handler. jQuery attaches it to event.data inside the callback — for example, .mousedown({ tool: 'brush' }, fn) lets fn read event.data.tool. This avoids closures when the same handler serves multiple elements. The modern equivalent is .on('mousedown', { tool: 'brush' }, fn).
Did you know?

The official jQuery API documents that if a user presses inside an element, drags away, and releases the button, mousedown still fired on that element — but click does not. That is why legacy drag code overwhelmingly uses .mousedown(fn) rather than .click(fn). When you migrate that code to modern jQuery, keep the mousedown event — only rename the binding API from .mousedown(fn) to .on("mousedown", fn).

Next: mouseup Event

Learn the release half of the click sequence — finish drags and pair with mousedown.

mouseup 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