JavaScript Element pointerdown Event

Beginner
5 min read
Updated: Nov 2026
3 examples
Event

Definition

In JavaScript, the pointerdown event fires when a pointer becomes active (MDN): mouse (first button pressed), touch (contact starts), or pen (stylus touches the digitizer).

Register a listener with addEventListener. Check readiness and browser support before you rely on this event.

Syntax

Listen for pointerdown. Start with this line.

JavaScript
addEventListener("pointerdown", fn)
CallWhat it does
addEventListener("pointerdown", fn)Primary signature.

Built into the browser. Listen with el.addEventListener("pointerdown", …) — no import required.

Library declarations
JavaScript
addEventListener("pointerdown", fn)

Parameters

ParameterDescription
Event nameRequired. "pointerdown"
Handler propOptional. onpointerdown
PointerEventRequired. pointerId, pointerType, …
CaptureOptional. setPointerCapture for drag tracking

Return Value

Return ValueDescription
*Fires as an Element event (listener receives the Event object).

JavaScript Examples

Example 1 — Log pointerdown (MDN)

MDN’s basic listener when a pointer becomes active.

JavaScript
const para = document.querySelector("p");

para.addEventListener("pointerdown", (event) => {
  console.log("Pointer down event", event.pointerId, event.pointerType);
});
Try It Yourself

How It Works

  1. Listen on an element that should receive the press.
  2. Handler runs when the pointer becomes active (MDN).
  3. Read pointerId to track this contact.
  4. Read pointerType to know mouse vs touch vs pen.

Example 2 — onpointerdown Property (MDN)

Same idea using the event handler property.

JavaScript
const para = document.querySelector("p");

para.onpointerdown = (event) => {
  console.log("Pointer down event");
};
Try It Yourself

How It Works

  1. Assign onpointerdown — MDN supports the handler property.
  2. Same event as addEventListener("pointerdown", …).
  3. Later assignment replaces the previous on* handler.
  4. Prefer addEventListener when you need multiple handlers.

Example 3 — Start Drag with setPointerCapture

Begin a gesture on down and keep moves targeted to this element.

JavaScript
const pad = document.getElementById("pad");

pad.addEventListener("pointerdown", (event) => {
  pad.setPointerCapture(event.pointerId);
  console.log("drag start", event.pointerId);
});

pad.addEventListener("pointerup", (event) => {
  console.log("drag end", event.pointerId);
});

pad.addEventListener("pointercancel", (event) => {
  console.log("drag aborted", event.pointerId);
});
Try It Yourself

How It Works

  1. On down — call setPointerCapture(pointerId).
  2. Moves stay on this element even if the pointer leaves its box.
  3. On up — finish the gesture (capture releases).
  4. On cancel — abort so the UI never sticks.

Browser Support

Element pointerdown is Baseline Widely available (MDN: since July 2020). Safe for modern evergreen browsers.

✓ Baseline · Widely available

pointerdown

Fires when a pointer becomes active — unified mouse, touch, and pen start.

99% Widely available
Google Chrome Yes
Yes
Microsoft Edge Yes
Yes
Mozilla Firefox Yes
Yes
Apple Safari Yes
Yes
Opera Yes
Yes
Internet Explorer IE11 (Pointer Events)
Partial
pointerdown Excellent

Bottom line: Prefer pointerdown to start cross-device gestures. See the MDN pointerdown reference.

Frequently Asked Questions

MDN: it fires when a pointer becomes active — mouse when the first button is pressed, touch when contact starts, pen when the stylus touches the digitizer.
No. MDN marks Element pointerdown as Baseline Widely available (since July 2020). It is not Deprecated, Experimental, or Non-standard.
A PointerEvent. Useful fields include pointerId, pointerType, isPrimary, and pressure.
MDN: with a physical mouse, mousedown fires for every button press. pointerdown fires only for the first button; extra buttons held at the same time do not fire more pointerdown events.
MDN: on touchscreen browsers that allow direct manipulation, pointerdown can trigger implicit capture so later events target the same element until pointerup or pointercancel (or releasePointerCapture).
Prefer it to start unified mouse/touch/pen gestures and setPointerCapture. Keep primary activate actions on click for keyboard accessibility.

Next: pointerenter

Continue with the Element pointerenter event.

pointerenter →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

14 people found this page helpful