Element: lostpointercapture

The lostpointercapture event is fired when a captured pointer is released.

Bubbles No
Cancelable No
Target objects Document, Element
Interface PointerEvent
Event handler onlostpointercapture

Examples

This example listens for the lostpointercapture event for an element, and captures the pointer for the element on pointerdown. When the user subsequently releases the pointer, the lostpointercapture event will be fired.

const para = document.querySelector('p');

para.addEventListener('lostpointercapture', () => {
  console.log('I\'ve been released!')
});

para.addEventListener('pointerdown', (event) => {
  para.setPointerCapture(event.pointerId);
});

The same example, but using the onlostpointercapture event handler property:

const para = document.querySelector('p');

para.onlostpointercapture = () => {
  console.log('I\'ve been released!')
};

para.addEventListener('pointerdown', (event) => {
  para.setPointerCapture(event.pointerId);
});

Browser compatibility

No compatibility data found. Please contribute data for "api.Element.lostpointercapture_event" (depth: 1) to the MDN compatibility data repository.

See also

Document Tags and Contributors

Last updated by: wbamberg,