Element: pointerup event

Baseline
Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2020.

The pointerup event is fired when a pointer is no longer active. Remember that it is possible to get a pointercancel event instead.

This behavior is different from mouseup events. When using a physical mouse, mouseup events fire whenever any button on a mouse is released. pointerup events fire only upon the last button release; previous button releases, while other buttons are held down, don't fire pointerup events.

Syntax

Use the event name in addEventListener():

js
addEventListener("pointerup", (event) => { })

Alternatively, assign to the event handler property of the interface:

js
onpointerup = (event) => { }

Event type

A PointerEvent. Inherits from Event.

Event UIEvent MouseEvent PointerEvent

Examples

Using addEventListener():

js
const para = document.querySelector("p");

para.addEventListener("pointerup", (event) => {
  console.log("Pointer up");
});

Using the onpointerup event handler property (but note that this replaces other event listeners added using onpointerup, if any):

js
const para = document.querySelector("p");

para.onpointerup = (event) => {
  console.log("Pointer up");
};

Specifications

Specification
Pointer Events
# pointerup
Pointer Events
# dom-globaleventhandlers-onpointerup

Browser compatibility

See also