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
Fundamentals
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.
Concept
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.
Foundation
📝 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:
All .mousedown() signatures return the original jQuery object for chaining.
Handler return values are ignored unless you use return false (equivalent to preventDefault() + stopPropagation()).
Cheat Sheet
⚡ Quick Reference
Goal
Legacy (.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 only
if (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()
Compare
📋 .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
Hands-On
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(){ ... })." );
} );
User presses mouse on #target → handler runs
#out text updates on press — before release
Deprecated — prefer .on("mousedown", fn) for new code
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.
Press Pen → "Tool: pen | eventData.mode: draw"
Press Brush → "Tool: brush | eventData.mode: draw"
Same handler, shared eventData on every .tool button
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.
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." );
} );
Press #legacy → legacy deprecation message
Press #modern → modern .on("mousedown") message
Behavior is identical — only the API name differs
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.
Left-press #handle → .active class added immediately
Release anywhere → .active removed on document mouseup
Right-click ignored (event.which !== 1)
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.
Applications
🚀 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).
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").
Important
📝 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.
Compatibility
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 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
.mousedown()Legacy API
Bottom line: Safe in legacy jQuery projects. Migrate bindings to .on('mousedown') and triggers to .trigger('mousedown') when updating code.
Wrap Up
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.
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
Summary
Key Takeaways
Knowledge Unlocked
Six things to remember about .mousedown()
Legacy bind, modern migrate.
6
Core concepts
.md01
.mousedown(fn)
Bind
Deprecated
data02
eventData
Since 1.4.3
Handler
()03
.mousedown()
Trigger
No args
.on04
.on("mousedown")
Modern
Replace
⚡05
.trigger()
Fire
Programmatic
3.306
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).