English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The onmouseup attribute is used to get or set the event handler function for the mouseup event of the current element
Execute JavaScript when the mouse button is released on a paragraph:
<!DOCTYPE html> <html> <head> <title>HTML onmousedown Event Attribute Usage (Basic Tutorial Website oldtoolbag.com)</title> </head> <body> <p id="p1" onmousedown="mouseDown()" onmouseup="mouseUp()"> Click the text! When a mouse button is pressed on this paragraph, the mouseDown() function will be triggered. This function sets the text color to red. When the mouse button is released, the mouseUp() function will be triggered. The mouseUp() function sets the text color to green./p> <script> function mouseDown() { document.getElementById("p1").style.color = "red"; } function mouseUp() { document.getElementById("p1").style.color = "green"; } </script> </body> </html>Test to see ‹/›
The mouseup event is triggered when the user releases a mouse button on the current element
IEFirefoxOperaChromeSafari
All major browsers support the onmouseup event attribute
The onmouseup attribute is triggered when the mouse button is released over an element.
Tip: Event triggering order related to onmouseup event (left/middle mouse button):
onmousedown
onmouseup
onclick
Event triggering order related to onmouseup event (right mouse button):
onmousedown
onmouseup
oncontextmenu
Note: The onmouseup attribute cannot be used on the following elements: <base>, <bdo>, <br>, <head>, <html>, <iframe>, <meta>, <param>, <script>, <style>, or<title>.
None.
<element onmouseup="script">
Value | Description |
---|---|
script | Specifies the script to be executed when the onmouseup event is triggered. |