HTML onmouseup Event Attribute

HTMLDOMWeb DevelopmentFront End Technology

The HTML onmouseup event attribute is triggered when a mouse button is released from an HTML element in an HTML document.


Following is the syntax −

<tagname onmouseup=”script”></tagname>

Let us see an example of HTML onmouseup event Attribute−


 Live Demo

<!DOCTYPE html>
   body {
      color: #000;
      height: 100vh;
      background-color: #FBAB7E;
      background-image: linear-gradient(62deg, #FBAB7E 0%, #F7CE68 100%);
      text-align: center;
   .circle {
      background: #db133a;
      height: 150px;
      width: 150px;
      border-radius: 50%;
      margin: 10px auto;
   p {
      margin: 30px auto;
<h1>HTML onmouseup Event Attribute Demo</h1>
<div class="circle" onmousedown="mouseDownFn()" onmouseup="mouseUpFn()"></div>
<p>Try to click the above red circle</p>
   function mouseDownFn() {
      document.querySelector('.circle').style.transform = 'scale(0.5)';
   function mouseUpFn() {
      document.querySelector('.circle').style.transform = 'scale(1.2)';


Click on “red” circle to observe how onmouseup event attribute works.

Published on 27-Sep-2019 15:45:24