![]() |
Definition and UsageThe onmouseup attribute fires when a mouse button is released over the element. Tip: The order of events related to the onmouseup event (for the left/middle mouse button):
The order of events related to the onmouseup event (for the right mouse button):
Applies toThe onmouseup attribute is part of the Event Attributes, and can be used on any HTML elements.
Browser Support |
Example:
HTML
<!DOCTYPE html>
<html>
<body>
<p id="p1" onmousedown="mouseDown()" onmouseup="mouseUp()">
Click the text! The mouseDown() function is triggered when the mouse button is pressed down over this paragraph. The function sets the color of the text to red. The mouseUp() function is triggered when the mouse button is released. The mouseUp() function sets the color of the text to green.
</p>
<script>
function mouseDown() {
document.getElementById("p1").style.color = "red";
}
function mouseUp() {
document.getElementById("p1").style.color = "green";
}
</script>
</body>
</html>
html onmouseup attribute |
How to Execute a JavaScript when releasing a mouse button over a paragraph - HTML onmouseup Attribute | HTML Attribute |
Read Full: | HTML Attribute |
Type: | Develop |
Category: | Web Tutorial |
Sub Category: | HTML Attribute |
Uploaded by: | Admin |
Views: | 71 |
Reffered: https://www.w3schools.com/tags/att_onmouseup.asp