Element.releasePointerCapture() is an instance method that stops pointer capture for a given pointerId. Learn the MDN horizontal slider pattern with setPointerCapture() on pointerdown and releasePointerCapture() on pointerup, cleanup on pointercancel, and five try-it labs aligned with MDN.
01
Kind
Instance method
02
Returns
undefined
03
Arg
pointerId
04
Action
Stop capture
05
Events
Pointer
06
Status
Baseline widely
Fundamentals
Introduction
When a user presses a mouse button, touches a screen, or uses a pen, the browser fires Pointer Events with a unique pointerId. With setPointerCapture(pointerId), an element keeps receiving pointer events even when the pointer moves outside it — perfect for dragging sliders, handles, and custom controls.
releasePointerCapture(pointerId)ends that capture. MDN: it releases (stops) pointer capture that was previously set for a specific pointer. Call it on pointerup, pointercancel, or whenever your interaction finishes.
💡
Beginner tip
Always pair setPointerCapture with releasePointerCapture using the same event.pointerId. Forgetting to release can leave your UI stuck in a “dragging” state.
Thumb moves while dragging; capture ends on pointerup.
How It Works
setPointerCapture keeps pointermove events on the thumb even when the pointer leaves the slider. releasePointerCapture on pointerup ends the interaction cleanly (MDN).
Example 2 — Release on pointerup
End capture when the user lifts the pointer after a drag.
Element.releasePointerCapture() is Baseline Widely available (MDN: across browsers since July 2020). Logos use the shared browser-image-sprite.png sprite from this project.
✓ Baseline Widely available
Element.releasePointerCapture()
Stop pointer capture for a pointerId — pair with setPointerCapture() for drag and slider UIs.
BaselineWidely available
Google ChromeSupported · Desktop & Mobile
Yes
Microsoft EdgeSupported · Chromium
Yes
Mozilla FirefoxSupported · Desktop & Mobile
Yes
Apple SafariSupported · macOS & iOS
Yes
OperaSupported · Modern versions
Yes
Internet ExplorerNot supported
No
releasePointerCapture()Excellent
Bottom line: Use releasePointerCapture() on pointerup or pointercancel after setPointerCapture(). Guard with hasPointerCapture() to avoid NotFoundError.
Wrap Up
Conclusion
Element.releasePointerCapture() stops pointer capture for a given pointerId. It is the cleanup companion to setPointerCapture() and works with hasPointerCapture() for safe release.
Call releasePointerCapture() on pointerup after drags
Also release on pointercancel for touch interruptions
Guard with hasPointerCapture() before releasing
Pass the same event.pointerId used in setPointerCapture
Use Pointer Events for mouse, touch, and pen input
❌ Don’t
Forget to release after setPointerCapture()
Call release with a stale or wrong pointerId
Release twice without checking (can throw NotFoundError)
Release on a different element than captured the pointer
Rely on mouse-only events for cross-device UIs
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about Element.releasePointerCapture()
End pointer capture cleanly.
5
Core concepts
📝01
Returns
undefined
API
📄02
When
pointerup
Event
👆03
Pair
setCap
Start
✅04
Guard
hasCap
safe
⚡05
Error
NotFound
MDN
❓ Frequently Asked Questions
It releases (stops) pointer capture that was previously set for a specific pointer identified by pointerId (MDN).
No. MDN marks Element.releasePointerCapture() as Baseline Widely available (across browsers since July 2020). It is not Deprecated, Experimental, or Non-standard.
Nothing useful — the return value is undefined (MDN).
The pointerId of a PointerEvent object, typically event.pointerId from pointerdown, pointermove, or pointerup (MDN).
On pointerup, pointercancel, or when your drag/slider interaction ends — after you previously called setPointerCapture(pointerId) (MDN).
MDN: a NotFoundError DOMException is thrown if pointerId does not match any active pointer.
Did you know?
MDN: call releasePointerCapture(pointerId) on pointerup after setPointerCapture(pointerId) so custom sliders and drag handles stop receiving captured events when the user lifts the pointer.