jQuery MouseUp Event  Method

jQuery MouseUp Event Method

jQuery mouseup() event method; In this tutorial, you will learn how to use mouseup event with HTML elements.

jQuery MouseUp Event Method

The jQuery mouseup event occurs when the mouse button is released after being pressed down on selected HTML elements. In other words, when a user clicks a mouse button and then lets go of it while the mouse cursor is over an HTML element, the mouseup event is triggered for that element. This event is often used to detect when a user completes a click action, like releasing a mouse button after pressing it.

Syntax of jQuery MouseUp Event Method

Here’s an syntax the mouseup event:

$(selector).mouseup()  

This triggers the jQuery mouseup event for selected elements.

$(selector).mouseup(function)  

Parameters of jQuery MouseUp Event Method

  • Function :- This is an optional parameter. This work when the mouseup event is triggered.

Example 1 of jQuery MouseUp Event Method

Let’s see an example 1 of mouseup() event.

<html>    
<head>    
<title>jQuery Mouse Up Event</title>
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>     
<script>    
$(document).ready(function(){    
    $("#first").mouseup(function(){    
       $( "span" ).text( "Mouseup event triggered" ).show().fadeOut( 3000 );   
    });    
});    
</script>    
</head>    
<body>    
<h5 id="first"> Button press and release</h5>   
<span></span>   
</body>    
</html>  

In this above example 1, you can see that mouseup() event is triggered when you mouse cursor pointer on html elements and click and released the mouse button. The mouseup event trigger and appear some text and hide in 3 seconds.

Example 2 of jQuery MouseUp Event Method

Let’s see an example 2 of mousep event.

<!DOCTYPE html>
<html>
<head>
<title>jQuery Mouse Up Event</title>
<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script> 
$(document).ready(function(){
	$("#second").mouseup(function(){
	    $( this ).text("Mouse Up Triggered");
	  });
	});
</script>
</head>
<body>
<div id="second">Click Here for Preview</div>
</body>
</html>

In this above example 2, you can see that mouseup() event is triggered when you mouse cursor pointer on html elements and click and released the mouse button. The mouseup event trigger and appear some text.

Recommended jQuery Tutorials

AuthorAdmin

Greetings, I'm Devendra Dode, a full-stack developer, entrepreneur, and the proud owner of Tutsmake.com. My passion lies in crafting informative tutorials and offering valuable tips to assist fellow developers on their coding journey. Within my content, I cover a spectrum of technologies, including PHP, Python, JavaScript, jQuery, Laravel, Livewire, CodeIgniter, Node.js, Express.js, Vue.js, Angular.js, React.js, MySQL, MongoDB, REST APIs, Windows, XAMPP, Linux, Ubuntu, Amazon AWS, Composer, SEO, WordPress, SSL, and Bootstrap. Whether you're starting out or looking for advanced examples, I provide step-by-step guides and practical demonstrations to make your learning experience seamless. Let's explore the diverse realms of coding together.

Leave a Reply

Your email address will not be published. Required fields are marked *