.mouseup() is a shorthand for binding or triggering the mouseup event (button release). With a handler it binds; with no arguments it triggers. Prefer .on / .trigger in new code.
Syntax
Start with these common calls. Keep them short and readable.
.mouseup() with no arguments fires the event — prefer .trigger("mouseup").
jQuery
$("#target").mouseup(function () {
console.log("Handler for mouseup called.");
});
$("#fire").click(function () {
$("#target").mouseup(); // same idea as .trigger("mouseup")
});
With a handler — .mouseup(handler) or .mouseup(eventData, handler) — it binds a callback that runs when a mouse button is released over the element. With no arguments — .mouseup() — it triggers mouseup on each matched element. Binding forms are deprecated since jQuery 3.3.
Yes. Prefer .on("mouseup", handler) or .on("mouseup", eventData, handler) to bind, and .trigger("mouseup") to fire. jQuery 3.x still runs .mouseup() for compatibility.
.mouseup(handler) only registers a callback. .mouseup() with no arguments triggers the event (same idea as .trigger("mouseup")).
Replace .mouseup(fn) with .on("mouseup", fn). Replace .mouseup(data, fn) with .on("mouseup", data, fn). Replace no-arg .mouseup() with .trigger("mouseup").
mouseup fires on release under the pointer. click needs press and release inside the same element. Prefer click for normal buttons; use mouseup for release / drag-end behavior.
Since 1.4.3 you can pass data before the handler. It appears as event.data inside the callback. Modern form: .on("mouseup", eventData, handler).