The mouseup() Event executes when a mouse button is released after clicking on an element(Be it a left click, right click or a middle button click).
<html>
<head>
<title> My First Programme </title>
</head>
<body>
<h1> JQuery </h1>
<p class = "para1"> First Paragraph </p>
<img src = "/myImage.png" alt = "Bring the mouse pointer here"/>
<script src = "https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"> </script>
<script>
$('img').mouseup( function() {
$('p').text("You have released the mouse button")
});
</script>
</body>
</html>
So, if you look at the above code, we have a <p> element,
<p class = "para1"> First Paragraph </p>
And we have an image,
<img src = "/myImage.png" alt = "Bring the mouse pointer here"/>
Now, if we take a look at the JQuery statement,
$('img').mouseup( function() {
$('p').text("You have pressed the mouse button")
});At first we locate the image,
$('img')Then we use the mouseup() event,
$('img').mouseup(...)And put the function inside mouseup() event to change the contents of <p> element.
$('img').mouseup( function() {
$('p').text("You have released the mouse button")
});And the function,
function() {
$('p').text("You have released the mouse button")
}Changes the content of <p> with the text,
'You have released the mouse button'
When the mouse button(Be it a left click, right click or a middle button click) is released after you have clicked on the image.