onmouseup Event
Example
Execute a JavaScript when releasing a mouse button over a paragraph:
<p onmouseup="mouseUp()">Click the text!</p>
Try it Yourself »
More examples below.
Definition and Usage
The onmouseup event occurs when a mouse button is released
over an element.
Events order for the left and middle mouse button:
- onmousedown
- onmouseup
- onclick
Events order for the right mouse button:
- onmousedown
- onmouseup
- oncontextmenu
Mouse Events
| Event | Occurs When |
|---|---|
| onclick | The user clicks on an element |
| oncontextmenu | The user right-clicks on an element |
| ondblclick | The user double-clicks on an element |
| onmousedown | A mouse button is pressed over an element |
| onmouseenter | The pointer is moved onto an element |
| onmouseleave | The pointer is moved out of an element |
| onmousemove | The pointer is moving over an element |
| onmouseout | The mouse pointer moves out of an element |
| onmouseover | The mouse pointer is moved over an element |
| onmouseup | The mouse button is released over an element |
See Also:
Tutorial:
Syntax
In JavaScript, using the addEventListener() method:
object.addEventListener("mouseup", myScript);
Try it Yourself »
Technical Details
| Bubbles: | Yes |
|---|---|
| Cancelable: | Yes |
| Event type: | MouseEvent |
| Supported HTML tags: | All HTML elements, EXCEPT: <base>, <bdo>, <br>, <head>, <html>, <iframe>, <meta>, <param>, <script>, <style>, and <title> |
| DOM Version: | Level 2 Events |
Browser Support
onmouseup is a DOM Level 2 (2001) feature.
It is fully supported in all browsers:
| Chrome | Edge | Firefox | Safari | Opera | IE |
| Yes | Yes | Yes | Yes | Yes | 9-11 |