This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2020.
The hasPointerCapture() method of the Element interface checks whether the element on which it is invoked has pointer capture for the pointer identified by the given pointer ID.
hasPointerCapture(pointerId)
pointerIdThe pointerId of a PointerEvent object.
A boolean value — true if the element does have pointer capture for the pointer identified by the given pointer ID, false if it doesn't.
<div id="target">Touch this element with a pointer.</div>
const el = document.getElementById("target");
el.addEventListener("pointerdown", (ev) => {
// Element 'target' will receive/capture further events
el.setPointerCapture(ev.pointerId);
// …
// Check whether element still has pointer capture
const pointerCap = el.hasPointerCapture(ev.pointerId);
if (pointerCap) {
// We've still got pointer capture
} else {
// oops, we've lost pointer capture!
}
});
| Specification |
|---|
| Pointer Events> # dom-element-haspointercapture> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
hasPointerCapture |
55 | 79 | 59 | 42 | 13 | 55 | 79 | 42 | 13 | 6.0 | 55 | 13 |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Element/hasPointerCapture