jQuery .mouseup() 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 .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

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.

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.

📝 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:

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

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

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

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

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

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

Official jQuery API migration note

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

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

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

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

Return value

  • All .mouseup() 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 (.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 onlyif (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()

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

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(){ ... })." );
} );
Try It Yourself

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
  );
} );
Try It Yourself

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.

jQuery
var count = 0;

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

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

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." );
} );
Try It Yourself

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() );
  } );
Try It Yourself

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.

🚀 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).
  • Proxy triggers$("#btn").click(function(){ $("#target").mouseup(); }) — replace inner no-arg .mouseup() with .trigger("mouseup").
  • Shared eventData$(".control").mouseup({ phase: "end" }, fn) passes metadata without closures.
  • 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").

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

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

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

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.

💡 Best Practices

✅ Do

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

❌ Don’t

  • Write new code with deprecated .mouseup(handler)
  • 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

Key Takeaways

Knowledge Unlocked

Six things to remember about .mouseup()

Legacy bind, modern migrate.

6
Core concepts
data 02

eventData

Since 1.4.3

Handler
() 03

.mouseup()

Trigger

No args
.on 04

.on("mouseup")

Modern

Replace
05

.trigger()

Fire

Programmatic
3.3 06

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

Next: mouseenter Event

Learn stable hover handlers — enter once, no child flicker.

mouseenter 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