HTMLElement: lostpointercapture event
The lostpointercapture
event is fired when a captured pointer is released.
Bubbles | Yes |
---|---|
Cancelable | No |
Interface | PointerEvent |
Event handler property | 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);
});
Specifications
Specification |
---|
Pointer Events # the-lostpointercapture-event |
Browser compatibility
BCD tables only load in the browser
See also
- Related events
onlostpointercapture
event handler property- This event on
Document
targets:lostpointercapture
event