Select an element, bind with .on, optionally check event.which.
Select the element(s): $("#box"), $("p"), etc.
Bind: .on("mouseup", function (event) { ... }).
Optional: gate on event.which === 1 for the left button.
To fire in code: .trigger("mouseup"). Unbind with .off("mouseup").
Piece
Required?
Role
"mouseup"
Yes
Event type string for .on / .trigger
handler
Yes (bind)
Runs on each button release
eventData
Optional
Extra data passed into the handler
Return value
—
jQuery set (chainable)
Pseudocode
Pseudocode
function onMouseup(element, handler):
when pointer is over element
and any mouse button is released:
handler(event) // event.which = 1|2|3
trigger(element, "mouseup"):
run all mouseup handlers on element
Reference
Cheat Sheet
Keep these facts handy while wiring release handlers.
Topic
Detail
Bind
.on("mouseup", handler) (1.7+)
Trigger
.trigger("mouseup") (1.0+)
When
Button released over the element
event.which
1 left · 2 middle · 3 right
vs click
Release only — press may have started elsewhere
Unbind
.off("mouseup")
Deprecated
.mouseup() shorthand (3.3+)
Try it
Live Preview
Run presets that use .on("mouseup") and .trigger("mouseup").
Uses .on("mouseup") and .trigger("mouseup") — same ideas as the examples below.
Result
Handler for mouseup called.
Code
jQuery Examples
Short, copy-ready snippets. Open DevTools Console, or use Try It Yourself for a live editor.
Example 1 — Bind a mouseup Handler
Official style: .on("mouseup", …) on a target element.
jQuery
$("#target").on("mouseup", function () {
console.log("Handler for mouseup called.");
});
Fire the same handlers with a single click on another control.
jQuery
$("#target").on("mouseup", function () {
console.log("Handler for mouseup called.");
});
$("#other").on("click", function () {
$("#target").trigger("mouseup");
});
Press mouse and release here. Mouse down. Mouse up.
How It Works
mousedown appends text on press.
mouseup appends text on release.
Order is always down then up for a normal press.
Chain both with .on on the same set.
Example 5 — Drag-End on document
Release can happen outside the handle — listen once on document.
jQuery
$("#handle").on("mousedown", function () {
console.log("Drag start");
$(document).one("mouseup", function () {
console.log("Drag end (anywhere)");
});
});
.one("mouseup") on document waits for any release.
Release outside the handle still ends the drag.
.one auto-removes the listener after it fires.
Edge Cases & Pitfalls
Watch these when relying on mouseup handlers.
deprecated
Avoid .mouseup() shorthand
Deprecated in 3.3. Use .on("mouseup") / .trigger("mouseup") / .off("mouseup").
vs click
Drag-onto release is still mouseup
Press elsewhere then release on an element still fires mouseup there. Prefer click for finished actions.
drag
End drags on document
Handle-only mouseup misses releases outside the element. Use $(document).one("mouseup", fn).
which
Gate logic on which === 1
Ignoring middle/right releases avoids fighting with scroll-click and context menus.
dynamic
New DOM nodes need delegation
Prefer .on("mouseup", "child", fn) on a stable parent for lists and boards.
Compatibility
Browser Support
The native mouseup event works in all browsers. Bind with .on("mouseup") since jQuery 1.7; .trigger("mouseup") since 1.0. Prefer these over the deprecated .mouseup() shorthand (3.3+).
✓ jQuery 1.7+ (.on)
mouseup event
Supported everywhere jQuery event APIs run in the browser. Use on/trigger for modern code.
100%Browser support
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
on("mouseup")Excellent
Bottom line: Bind with .on("mouseup", fn). Check event.which for the primary button. Prefer click when you need a full press-and-release.
Analysis
Performance Notes
Approach
Cost
Best for
Direct .on("mouseup")
1 handler / element
Few static controls
Delegated .on
1 handler / parent
Lists / canvases / dynamic UI
$(document).one("mouseup")
Temporary listener
Drag-end / gesture finish
Keep release handlers light. Use .one for one-shot drag-end listeners so they do not linger after the gesture.
Remember
Key Takeaways
Bind:.on("mouseup", handler) — not deprecated .mouseup().
Timing: fires on release — press may have started elsewhere.
Buttons: use event.which (1 left / 2 middle / 3 right).
Prefer click for finished actions; mouseup for release / drag-end.
One line: use .on("mouseup", fn) for release handling — listen on document when the gesture can end anywhere.
Frequently Asked Questions
mouseup fires when the mouse button is released while the pointer is over an element. Bind with .on("mouseup", handler) (jQuery 1.7+). Any HTML element can receive it.
Prefer .on("mouseup", handler). The .mouseup(handler) shorthand is deprecated since jQuery 3.3. To fire the event, use .trigger("mouseup") instead of .mouseup().
mouseup fires on release under the pointer. click needs both mousedown and mouseup inside the same element. Prefer click for normal buttons; use mouseup when you need release-time behavior.
Yes. Press outside, drag onto an element, then release — mouseup still fires on that element. The jQuery API notes most UIs do not treat this as a button press, so prefer click unless mouseup is intentional.
Call $(selector).trigger("mouseup"). That runs bound handlers. Use .triggerHandler("mouseup") to run handlers without bubbling or default actions.
Start on mousedown, finish on mouseup. For drag-end, listen on document — e.g. $(document).one("mouseup", fn) — so release anywhere ends the drag, not only over the handle.