Contents:
.on( "mouseup" [, eventData ], handler )Returns: jQuery
Description: Bind an event handler to the "mouseup" event.
-
version added: 1.7.on( "mouseup" [, eventData ], handler )
This page describes the mouseup
event. For the deprecated .mouseup()
method, see .mouseup()
.
The mouseup
event is sent to an element when the mouse pointer is over the element, and the mouse button is released. Any HTML element can receive this event.
For example, consider the HTML:
1
2
3
4
5
6
|
|
The event handler can be bound to any <div>
:
1
2
3
|
|
Now if we click on this element, the alert is displayed:
Handler for `mouseup` called.
We can also trigger the event when a different element is clicked:
1
2
3
|
|
After this code executes, clicks on Trigger the handler will also alert the message.
If the user clicks outside an element, drags onto it, and releases the button, this is still counted as a mouseup
event. This sequence of actions is not treated as a button press in most user interfaces, so it is usually better to use the click
event unless we know that the mouseup
event is preferable for a particular situation.
Example:
Show texts when mouseup and mousedown event triggering.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
|
Demo:
.trigger( "mouseup" )Returns: jQuery
Description: Trigger the "mouseup" event on an element.
-
version added: 1.0.trigger( "mouseup" )
-
"mouseup"Type: stringThe string
"mouseup"
.
-
See the description for .on( "mouseup", ... )
.