jQuery Tutorial Tutorials - jQuery .mouseup() method

jQuery .mouseup() method

The .mouseup() method in jQuery is used to bind an event handler to the mouseup event on the elements, or trigger that event on an element.

When the mouse pointer is over the element and any mouse button is released, the event mouseup is fired.

jQuery .mouseup() method Syntax

.mouseup()
.mouseup(handler)
.mouseup(eventData,handler)

.mouseup(handler) and .mouseup(eventData,handler) are shortcut for .on( "mouseup", handler )

.mouseup() is shortcut for .trigger( "mouseup" )

Parameter Type Description
handler Function A function to execute when the mouseup is triggered on the matched element.
eventData Anything Additional data passed to the event handler.

jQuery .mouseup() method Example

example

Trigger the mouseup event on target:
HTML

<div id="target">target</div>
<div id="btn">
  Trigger mouseup event on target
</div>

jQuery

$( "#target" ).mouseup(function() {
    console.log( "mouseup." );
});

$("#btn").click(function(){
    $( "#target" ).mouseup();
}

jQuery .mouseup([eventData,]handler) method Example

example

Following is a simple example that how texts when mouseup event triggering.

$("p").mouseup( function () { $(this).hide(); });

Try now

Date:2019-08-30 01:13:50 From:www.Lautturi.com author:Lautturi