onmouseup-händelse

Definition and usage

The onmouseup event occurs when the user releases the mouse button over an element.

Tip:Event order related to onmouseup event (for left mouse button/middle mouse button):

  1. onmousedown
  2. onmouseup
  3. onclick

Event order related to onmouseup event (for right mouse button):

  1. onmousedown
  2. onmouseup
  3. oncontextmenu

Example

Execute JavaScript when the mouse button is released over a paragraph:

<p onmouseup="mouseUp()">Click the text!</p>

Try it yourself

Syntax

In HTML:

<element onmouseup="myScript">

Try it yourself

In JavaScript:

object.onmouseup = function(){myScript};

Try it yourself

In JavaScript, use the addEventListener() method:

object.addEventListener("mouseup", myScript);

Try it yourself

Note:Internet Explorer 8 or earlier versions do not support addEventListener() method.

Technical details

Bubbling: Stöd
Cancellable: Stöd
Event types: MouseEvent
Supported HTML tags: All HTML elements except: <base>, <bdo>, <br>, <head>, <html>, <iframe>, <meta>, <param>, <script>, <style> and <title>
DOM version: Nivå 2-händelser

Webbläsarstöd

Händelser Chrome IE Firefox Safari Opera
onmouseup Stöd Stöd Stöd Stöd Stöd