The gotpointercapture
event is fired when an element captures a pointer using setPointerCapture()
.
Bubbles | No |
---|---|
Cancelable | No |
Interface | PointerEvent |
Event handler property | ongotpointercapture |
The gotpointercapture
event is fired when an element captures a pointer using setPointerCapture()
.
Bubbles | No |
---|---|
Cancelable | No |
Interface | PointerEvent |
Event handler property | ongotpointercapture |
This example gets a <p>
element and listens for the gotpointercapture
event. It then calls setPointerCapture()
on the element on a pointerdown
event, which will trigger gotpointercapture
.
const para = document.querySelector('p'); document.addEventListener('gotpointercapture', () => { console.log('I\'ve been captured!') }); para.addEventListener('pointerdown', (event) => { para.setPointerCapture(event.pointerId); });
The same example, using the ongotpointercapture
event handler property:
const para = document.querySelector('p'); document.ongotpointercapture = () => { console.log('I\'ve been captured!') }; para.addEventListener('pointerdown', (event) => { para.setPointerCapture(event.pointerId); });
Specification |
---|
Pointer Events # the-gotpointercapture-event |
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
gotpointercapture_event |
57 |
17 |
59 |
No |
44 |
13 |
57 |
57 |
79 |
43 |
13 |
7.0 |
ongotpointercapture
event handler propertyHTMLElement
targets: gotpointercapture
event
© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Document/gotpointercapture_event