The .mouseup() method is jQuery’s legacy shorthand for binding and triggering the mouseup event. This tutorial covers .mouseup(handler) since 1.0, .mouseup(eventData, handler) since 1.4.3, no-argument .mouseup() as a trigger, migration to .on("mouseup") and .trigger("mouseup"), and why the binding form is deprecated since jQuery 3.3. For the modern mouseup event API, see the jQuery mouseup event tutorial.
01
.mouseup(fn)
Bind handler
02
eventData
Since 1.4.3
03
.mouseup()
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(), .mouseup(), .keydown(), and dozens more. The .mouseup() method let you bind a handler in one short call: $("#handle").mouseup(function(){ ... }). It remains in jQuery 3.x for backward compatibility but is marked deprecated.
Understanding .mouseup() matters when reading older drag-and-drop code, drawing tools, and legacy tutorials that finish gestures on release. The method does two distinct jobs: with a function argument it binds; with no arguments it triggers. Modern jQuery splits those roles explicitly — .on("mouseup", handler) for binding and .trigger("mouseup") for firing. This page documents the shorthand API and shows how to migrate.
Concept
Understanding the .mouseup() Method
The official jQuery API describes .mouseup() as a way to bind an event handler to the mouseup 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 releases a mouse button while the pointer is over that element — the same mouseup event that .on("mouseup") handles today.
When you call .mouseup() with no arguments, jQuery synthetically fires the mouseup event on each matched element. Bound handlers run immediately. This trigger behavior is equivalent to .trigger("mouseup").
⚠️
Deprecated since jQuery 3.3
Do not use .mouseup(handler) or .mouseup(eventData, handler) in new code. Replace them with .on("mouseup", handler) or .on("mouseup", eventData, handler). Replace no-argument .mouseup() with .trigger("mouseup"). For delegation, event.which, and comparison with click, read the jQuery mouseup event tutorial.
Foundation
📝 Syntax
The .mouseup() method has three signatures from the official jQuery API. The binding forms are deprecated; the trigger form remains valid but .trigger("mouseup") is preferred:
All .mouseup() 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 (.mouseup)
Modern replacement
Bind mouseup handler
$("#box").mouseup(fn) ⚠
$("#box").on("mouseup", fn)
Pass data to handler
$("#box").mouseup({ tool: "pen" }, fn) ⚠
$("#box").on("mouseup", { tool: "pen" }, fn)
Left button only
if (event.which !== 1) return; — works in both APIs
Trigger mouseup programmatically
$("#target").mouseup()
$("#target").trigger("mouseup")
Remove mouseup handlers
$("#box").off("mouseup")
Delegated mouseup on children
$("#panel").on("mouseup", ".handle", fn) — not available via .mouseup()
One-time mouseup
$("#box").one("mouseup", fn) — use .one(), not .mouseup()
Compare
📋 .mouseup() vs .on("mouseup") vs .trigger("mouseup") vs .off("mouseup")
Four related APIs — know which one binds, which one fires, and which one removes handlers.
.mouseup()
deprecated
Legacy bind (.mouseup(fn)) or trigger (.mouseup()) — use modern APIs for new code
.on("mouseup")
bind
Modern binding since 1.7 — supports eventData and delegation on dynamic content
.trigger("mouseup")
fire
Programmatically run handlers — clearer than no-arg .mouseup()
.off("mouseup")
remove
Unbind handlers — pair with .on("mouseup") when cleaning up or in SPAs
Hands-On
Examples Gallery
Five examples cover binding, eventData, triggering, migration from .mouseup() to .on("mouseup"), and a legacy mousedown + mouseup press-feedback pair. Use the Try-it links to run each snippet in the browser. Remember: binding with .mouseup(handler) is deprecated — these demos show legacy syntax you will encounter in older code.
📚 Binding & Triggering
Legacy .mouseup() signatures for binding handlers and firing events programmatically.
Example 1 — Bind Handler with .mouseup(handler)
The canonical legacy pattern — attach a function that runs when the user releases the mouse button on the element.
jQuery
$( "#target" ).mouseup( function() {
$( "#out" ).text( "Handler ran via .mouseup(function(){ ... })." );
} );
User releases mouse on #target → handler runs
#out text updates on release — after button let go
Deprecated — prefer .on("mouseup", fn) for new code
How It Works
.mouseup(fn) registers the function on the element. jQuery internally routes this to .on("mouseup", fn). The handler runs when the button is released — the release half of the click sequence.
Example 2 — Pass eventData with .mouseup(eventData, handler)
Since jQuery 1.4.3, pass an object before the handler — it arrives as event.data.
jQuery
$( ".control" ).mouseup( { phase: "end" }, function( event ) {
var id = $( this ).data( "id" );
$( "#out" ).text(
"Control: " + id + " | eventData.phase: " + event.data.phase
);
} );
Release Control A → "Control: a | eventData.phase: end"
Release Control B → "Control: b | eventData.phase: end"
Same handler, shared eventData on every .control trigger
How It Works
jQuery stores the { phase: "end" } object and injects it into event.data when any matched .control is released. Use $(this).data("id") for per-element attributes. Modern equivalent: .on("mouseup", { phase: "end" }, fn).
Example 3 — Trigger mouseup with No-Argument .mouseup()
Calling .mouseup() without a handler fires the mouseup event programmatically.
Release on #target directly → count increments
Click #fire → $("#target").mouseup() → same handler runs
No-arg .mouseup() is trigger shorthand — prefer .trigger("mouseup")
How It Works
The first .mouseup(function(){ ... }) binds a handler on #target. The second binds on #fire and calls $("#target").mouseup() with no arguments — that synthetically fires mouseup. Replace with $("#target").trigger("mouseup") for clarity.
📈 Migration & Release-Time UI
Compare legacy and modern APIs, and use mouseup for release-time cleanup.
Example 4 — Migration: .mouseup(fn) vs .on("mouseup", fn)
Both bind the same mouseup event — .on() is the recommended API for new code.
jQuery
$( "#legacy" ).mouseup( function() {
$( "#out" ).text( "Legacy: .mouseup(function(){ ... }) — deprecated since jQuery 3.3." );
} );
$( "#modern" ).on( "mouseup", function() {
$( "#out" ).text( "Modern: .on('mouseup', function(){ ... }) — use this for new code." );
} );
Press #legacy → legacy deprecation message
Press #modern → modern .on("mouseup") message
Behavior is identical — only the API name differs
How It Works
Under the hood, .mouseup(fn) calls .on("mouseup", fn). Migration is a straight rename with no behavior change for simple bindings. The advantage of .on() is delegation — $("#panel").on("mouseup", ".handle", fn) — which .mouseup() cannot do.
Example 5 — Legacy .mousedown() + .mouseup() Press Feedback
Classic legacy pair — add .active on deprecated .mousedown(), remove on .mouseup(). Migrate both to .on() in new code.
jQuery
$( ".btn" )
.mousedown( function() {
$( this ).addClass( "active" );
$( "#out" ).text( "mousedown → .active on " + $( this ).text() );
} )
.mouseup( function() {
$( this ).removeClass( "active" );
$( "#out" ).text( "mouseup → .active removed on " + $( this ).text() );
} );
Press Button A → .active added via .mousedown()
Release Button A → .active removed via .mouseup()
Legacy shorthand pair — prefer .on("mousedown") and .on("mouseup") for new code
How It Works
Older tutorials chain deprecated .mousedown(fn) and .mouseup(fn) for instant press feedback. Both binding forms are deprecated since 3.3 — replace with .on("mousedown", fn).on("mouseup", fn). For drag UIs, bind document-level mouseup so release outside the handle still cleans up.
Applications
🚀 Common Use Cases
Reading legacy code — recognize $("#handle").mouseup(fn) as equivalent to .on("mouseup", fn) in older drag libraries.
Drawing tools — legacy canvas code often uses .mouseup(fn) to finish strokes — migrate to .on("mouseup", fn).
Release cleanup — finish drags with .mouseup(fn) or $(document).one("mouseup", fn).
Automated testing — test suites may call .mouseup() to simulate release — consider .trigger("mouseup") for explicit intent.
🧠 How .mouseup() Routes Through jQuery
1
You call .mouseup()
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
.mouseup(handler) delegates internally to .on("mouseup", handler) — the handler is stored in jQuery’s event system.
.on("mouseup")
3
Trigger path
No-arg .mouseup() delegates to .trigger("mouseup") — bound handlers run on each matched element.
.trigger("mouseup")
4
👉
jQuery object returned
Both paths return the original collection for chaining — .mouseup(fn).addClass("ready") works the same as .on("mouseup", fn).addClass("ready").
Important
📝 Notes
Deprecated since jQuery 3.3 — do not use .mouseup(handler) or .mouseup(eventData, handler) in new code. Use .on("mouseup") instead.
Bind with .mouseup(handler) since jQuery 1.0; eventData form since 1.4.3.
No-argument .mouseup() triggers the event since jQuery 1.0 — prefer .trigger("mouseup").
.mouseup() does not support event delegation — use .on("mouseup", selector, fn) for dynamic handles.
Remove handlers with .off("mouseup") — not by calling .mouseup(undefined).
Legacy code using .mouseup() still runs in jQuery 3.x — migrate when you refactor those files.
For the full modern mouseup event guide — event.which, comparison with click, and drag patterns — see the jQuery mouseup event tutorial.
Compatibility
Browser Support
The underlying mouseup event is a standard DOM event supported in every browser jQuery targets. The .mouseup() method itself is a jQuery API — it works in jQuery 1.x, 2.x, and 3.x. Binding via .mouseup(handler) is deprecated since 3.3 but still functional; triggering via no-arg .mouseup() also remains supported.
✓ jQuery 1.0+
jQuery .mouseup() method
Supported across all jQuery versions you are likely to maintain. Deprecated binding since 3.3 — use .on('mouseup') for new projects. Native equivalent for binding: element.addEventListener('mouseup', 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
.mouseup()Legacy API
Bottom line: Safe in legacy jQuery projects. Migrate bindings to .on('mouseup') and triggers to .trigger('mouseup') when updating code.
Wrap Up
Conclusion
The jQuery .mouseup() method is the legacy shorthand for binding and triggering mouseup handlers. Use .mouseup(handler) or .mouseup(eventData, handler) to bind — both deprecated since jQuery 3.3. Use no-argument .mouseup() to trigger — equivalent to .trigger("mouseup").
For new code, prefer .on("mouseup", fn) for binding and .trigger("mouseup") for programmatic firing. When you encounter .mouseup() in older projects, recognize it, understand it, and migrate when practical. For delegation, event.which, and the complete modern mouseup workflow, continue with the jQuery mouseup event tutorial.
Assume .mouseup() supports delegation — it does not
Confuse .mouseup(fn) (bind) with .mouseup() (trigger)
Use .unbind("mouseup") — it is also deprecated; use .off("mouseup")
Replace click with mouseup on buttons unless you need press-time behavior
Summary
Key Takeaways
Knowledge Unlocked
Six things to remember about .mouseup()
Legacy bind, modern migrate.
6
Core concepts
.md01
.mouseup(fn)
Bind
Deprecated
data02
eventData
Since 1.4.3
Handler
()03
.mouseup()
Trigger
No args
.on04
.on("mouseup")
Modern
Replace
⚡05
.trigger()
Fire
Programmatic
3.306
Deprecated
Since 3.3
Migrate
❓ Frequently Asked Questions
The .mouseup() method has two roles. With a handler argument — .mouseup(handler) or .mouseup(eventData, handler) — it binds a function that runs when the user releases a mouse button over the matched element. With no arguments — .mouseup() — it triggers the mouseup 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 .mouseup(handler) and .mouseup(eventData, handler) are deprecated since jQuery 3.3. Use .on('mouseup', handler) or .on('mouseup', eventData, handler) instead. The no-argument .mouseup() trigger form still works but .trigger('mouseup') is clearer and preferred in modern code. Existing legacy code continues to run in jQuery 3.x; migrate when you touch those files.
.mouseup(handler) registers a callback — it does not fire the event immediately. .mouseup() with no arguments triggers the mouseup event programmatically on every matched element, the same as .trigger('mouseup'). 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 .mouseup(fn) with .on('mouseup', fn). Replace .mouseup(data, fn) with .on('mouseup', data, fn). Replace no-arg .mouseup() with .trigger('mouseup'). Replace .unbind('mouseup') cleanup with .off('mouseup'). Under the hood, .mouseup(handler) already delegates to .on('mouseup') — migration is a straight rename with no behavior change for simple bindings.
Yes. jQuery 3.x keeps .mouseup() 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 .mouseup(handler) in new code — prefer the modern API covered in the jQuery mouseup 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, .mouseup({ phase: 'end' }, fn) lets fn read event.data.phase. This avoids closures when the same handler serves multiple elements. The modern equivalent is .on('mouseup', { phase: 'end' }, fn).
Did you know?
The official jQuery API documents that if a user presses inside an element, drags away, and releases the button, mouseup still fired on that element — but click does not. That is why legacy drag code overwhelmingly uses .mouseup(fn) rather than .click(fn). When you migrate that code to modern jQuery, keep the mouseup event — only rename the binding API from .mouseup(fn) to .on("mouseup", fn).