Last Updated : 15 Jun, 2023
The HTML DOM onmouseup event occurs on the release of a pressed button on a mouse over an element.
Related events for left-click:
Related events for right-click:
Supported Tags: It supports All HTML elements, EXCEPT:
Syntax:
<element onmouseup="myScript">
object.onmouseup = function(){myScript};
object.addEventListener("mouseup", myScript);
Example: In this example, we will use the HTML DOM onmouseup event.
HTML
<!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:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4