The HTML DOM onmouseup event occurs on the release of a pressed button on a mouse over an element.
Related events for left-click:
- onmousedown
- onmouseup
- onclick
Related events for right-click:
- onmousedown
- onmouseup
- oncontextmenu
Supported Tags: It supports All HTML elements, EXCEPT:
- <base>
- <bdo>
- <br>
- <head>
- <html>
- <iframe>
- <meta>
- <param>
- <script>
- <style>
- <title>
Syntax:
- In HTML:
<element onmouseup="myScript">
- In JavaScript:
object.onmouseup = function(){myScript};- In JavaScript, using the addEventListener() method:
object.addEventListener("mouseup", myScript);
Example: In this example, we will use the HTML DOM onmouseup event.
<!DOCTYPE html>
<html>
<head>
<title>
HTML DOM onmousedown Event
</title>
</head>
<body>
<h1 style="color:green">
GeeksforGeeks
</h1>
<h2 id="try">
HTML DOM onmousedown Event
</h2>
<script>
document.getElementById(
"try").addEventListener(
"mousedown", btnpressed);
document.getElementById(
"try").addEventListener(
"mouseup", btnup);
function btnpressed() {
document.getElementById(
"try").innerHTML = "Button Pressed.";
}
function btnup() {
document.getElementById(
"try").innerHTML = "Button Released.";
}
</script>
</body>
</html>
Output:

Supported Browsers: The browsers supported by HTML DOM onmouseup Event are listed below:
- Google Chrome
- Internet Explorer
- Firefox
- Apple Safari
- Opera