In JavaScript, the mouseup event fires when a pointing-device button is released while the pointer is inside the element (MDN). It is the counterpoint to mousedown. The event type is a MouseEvent.
Register a listener with addEventListener. Check readiness and browser support before you rely on this event.
Start on the handle. Only primary button begins the drag.
End on window. Release can happen outside the handle.
Guard with a flag. Ignore stray mouseups when not dragging.
Still use click for simple button activate — not for drag tracking.
Compatibility
Browser Support
Elementmouseup is Baseline Widely available (MDN, since July 2015). It is a standard MouseEvent — not Deprecated, Experimental, or Non-standard.
✓ Baseline · Widely available
Element mouseup
Fires when a pointing-device button is released inside the element. Counterpoint to mousedown.
99%Modern browser support
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
Android WebViewSupported · Modern WebView
Full support
mouseupExcellent
Bottom line: Safe everywhere students build today. Use mouseup for release / drag-end; keep primary activate actions on click.
Frequently Asked Questions
It fires when a pointing-device button is released while the pointer is located inside the element. It is the counterpoint to mousedown (MDN).
No. MDN marks Element mouseup as Baseline Widely available (since July 2015). It is not Deprecated, Experimental, or Non-standard.
A MouseEvent (inherits from UIEvent and Event). Useful fields include button, buttons, clientX, clientY, and modifier keys such as ctrlKey and shiftKey.
mouseup fires when the button goes up. click fires after a completed press-and-release activation (typically after mousedown and mouseup). Prefer click for primary UI actions so keyboard users are included.
With a physical mouse, mouseup fires whenever any button is released. pointerup fires only for the last button release; earlier releases while other buttons remain held do not fire pointerup (MDN).
Use it to end a press, finish a drag, clear pressed styles, or react to a specific button release. Keep primary activate-on-click actions on click.