Javascript Ajax jQuery Html PHP Example Quiz New MORE

How to add mouseup() event jQuery

The mouseup() method is an inbuilt method in jQuery. It works when mouse left button is clicked and released over a HTML element. This method can accept only one parameter and this is optional.

Syntax:

$(selector).mouseup(parameter)

Example:

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>mouseup demo</title>
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
</head>
<body>

<p>Press mouse and release here.</p>

<script>
$( "p" ).mouseup(function() {
    $( this ).append( "<span style='color:#f00;'>Mouse up.</span>" );
  })
  $( "p" ).mousedown(function() {
    $( this ).append( "<span style='color:#00f;'>Mouse down.</span>" );
  });
</script>

</body>
</html>
Run it Yourself »