JavaScript Element pointerdown Event

Beginner
⏱️ 11 min read
📚 Updated: Jul 2026
🎯 5 Examples
🚀 5 Try-it labs
DOM event
Instance event

What You’ll Learn

The pointerdown event fires when a pointer becomes active. Learn addEventListener vs onpointerdown, pointerId / pointerType, how it differs from mousedown, implicit touch capture, drag-start with setPointerCapture, and five try-it labs.

01

Kind

Instance event

02

Type

PointerEvent

03

When

Pointer becomes active

04

Handler

onpointerdown

05

Pair ends

pointerup · pointercancel

06

Status

Baseline widely available

Introduction

pointerdown answers: “Did a pointer just become active on this element?” That covers mouse (first button), touch (finger down), and pen (stylus contact) under one API.

Prefer Pointer Events when you want one code path for mouse, touch, and pen. Keep primary UI activation on click so keyboard users share the same path.

💡
Beginner tip

With a physical mouse, mousedown fires for every button press. pointerdown fires only for the first button; extra buttons held together do not fire more pointerdown events.

Understanding pointerdown

An instance event that answers: “Did this pointer just go active?”

  • Mouse — first button pressed (not each additional button).
  • Touch — physical contact with the digitizer.
  • Pen — stylus makes contact with the digitizer.
  • PointerEventpointerId, pointerType, isPrimary, and more.
  • Baseline Widely available on MDN (since July 2020).

📝 Syntax

Use the event name with addEventListener, or set the handler property:

JavaScript
addEventListener("pointerdown", (event) => { });

onpointerdown = (event) => { };

Event type

A PointerEvent (inherits from MouseEvent and Event).

Handy properties

PropertyMeaning
pointerIdUnique id for this pointer stream (key multi-touch state by this)
pointerTypemouse, pen, touch, etc.
isPrimaryWhether this is the primary pointer of that type
clientX / clientYPointer position in the viewport
pressure / width / heightContact geometry and pressure when available

🤳 Implicit Pointer Capture

MDN notes that on touchscreen browsers that allow direct manipulation, pointerdown can trigger implicit pointer capture. The target then receives later pointer events as if they occurred over it.

  • While that capture is set, pointerover / pointerenter / pointerleave / pointerout may not fire as you would expect.
  • Release with releasePointerCapture(), or wait for pointerup / pointercancel.
  • You can also call setPointerCapture(pointerId) yourself for drag UIs.

⚡ Quick Reference

GoalCode / note
Listenel.addEventListener("pointerdown", fn)
Handler propertyel.onpointerdown = fn
Identify pointerevent.pointerId, event.pointerType
Start dragel.setPointerCapture(event.pointerId)
End pathspointerup and pointercancel
MDN statusBaseline Widely available (Jul 2020)

🔍 At a Glance

Four facts to remember about pointerdown.

Event type
PointerEvent

MouseEvent + more

Means
active now

First contact

vs mousedown
1st button

Not every press

Baseline
yes

Since Jul 2020

Examples Gallery

Examples follow MDN Element: pointerdown event. Press with a mouse, touch, or pen on the stage elements.

📚 Getting Started

MDN listener patterns and the handler property.

Example 1 — Log pointerdown (MDN)

Fire when a pointer becomes active on the paragraph.

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

para.addEventListener("pointerdown", (event) => {
  out.textContent = "Pointer down event";
});
Try It Yourself

How It Works

The listener runs as soon as the pointer goes active—no need to release.

Example 2 — onpointerdown Property (MDN)

Same idea using the handler property form.

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

para.onpointerdown = (event) => {
  out.textContent = "onpointerdown at " + event.clientX + "," + event.clientY;
};
Try It Yourself

How It Works

Prefer addEventListener when you need multiple listeners or easy removal.

📈 IDs, Capture & vs mousedown

Identify the pointer, start capture for drag, and compare fire rates with mousedown.

Example 3 — Log pointerId and Type

See which device and id started the contact.

JavaScript
const stage = document.getElementById("stage");
const out = document.getElementById("out");

stage.addEventListener("pointerdown", (event) => {
  out.textContent =
    "down id=" + event.pointerId +
    " type=" + event.pointerType +
    " primary=" + event.isPrimary;
});
Try It Yourself

How It Works

Multi-touch UIs should store session state keyed by pointerId.

Example 4 — Start Drag with setPointerCapture

On pointerdown, capture the pointer so moves keep targeting the handle.

JavaScript
const handle = document.getElementById("handle");
const out = document.getElementById("out");

handle.addEventListener("pointerdown", (event) => {
  handle.setPointerCapture(event.pointerId);
  handle.classList.add("is-dragging");
  out.textContent = "captured id=" + event.pointerId;
});

handle.addEventListener("pointerup", (event) => {
  handle.classList.remove("is-dragging");
  out.textContent = "released";
});

handle.addEventListener("pointercancel", () => {
  handle.classList.remove("is-dragging");
  out.textContent = "cancelled";
});
Try It Yourself

How It Works

Capture ends on pointerup / pointercancel (or releasePointerCapture). Also listen for gotpointercapture / lostpointercapture when you care about the capture lifecycle itself.

Example 5 — pointerdown vs mousedown Counts

Hold multiple mouse buttons and compare how often each event fires.

JavaScript
const stage = document.getElementById("stage");
const out = document.getElementById("out");
let pointerCount = 0;
let mouseCount = 0;

stage.addEventListener("pointerdown", () => {
  pointerCount++;
  render();
});

stage.addEventListener("mousedown", () => {
  mouseCount++;
  render();
});

function render() {
  out.textContent =
    "pointerdown=" + pointerCount + " mousedown=" + mouseCount;
}
Try It Yourself

How It Works

MDN’s classic distinction: extra mouse buttons produce more mousedown events, not more pointerdown events.

🚀 Common Use Cases

  • Start drag, draw, or resize sessions for mouse, touch, and pen.
  • Call setPointerCapture so moves stay on your handle.
  • Show pressed / active feedback immediately.
  • Branch by pointerType when stylus pressure or tilt matters.
  • Teach unified Pointer Events vs mouse-only mousedown.

🔧 How It Works

1

Pointer idle

No active contact / no mouse buttons down for that pointer.

Idle
2

pointerdown

Pointer becomes active; PointerEvent carries id and type.

Active
3

Moves / capture

Optional setPointerCapture; touch may capture implicitly.

Session
4

pointerup or pointercancel

Normal release or browser abort; clear gesture state.

📝 Notes

  • MDN: Baseline Widely available (since July 2020) — no Deprecated / Experimental / Non-standard banner.
  • Primary UI actions: prefer click so keyboard users share the same path.
  • Clear gesture state on both pointerup and pointercancel.
  • Implicit touch capture can suppress some over/leave events until release.
  • Related learning: pointercancel, pointerenter, mousedown, addEventListener(), JavaScript hub.

Browser Support

pointerdown is marked Baseline Widely available on MDN (since July 2020). Logos use the shared browser-image-sprite.png sprite from this project. Pointer Events unify mouse, touch, and pen across modern engines.

Baseline · Widely available

Element pointerdown

Fires when a pointer becomes active; pair with pointerup / pointercancel and prefer click for primary actions.

Full Widely available
Google Chrome Full support
Yes
Mozilla Firefox Full support
Yes
Apple Safari Full support
Yes
Microsoft Edge Full support
Yes
Opera Full support
Yes
Internet Explorer Pointer Events (legacy IE11 path)
Partial
pointerdown Baseline

Bottom line: Use pointerdown to start unified gestures. Remember the first-button difference vs mousedown on multi-button mice.

Conclusion

pointerdown is the unified “pointer became active” signal. Use it to start gestures, capture pointers for drag, and branch by device type—then end on pointerup or pointercancel.

Continue with pointerenter, pointercancel, mousedown, or the JavaScript hub.

💡 Best Practices

✅ Do

  • Prefer pointerdown for unified mouse/touch/pen gesture starts
  • Key multi-touch state by pointerId
  • Call setPointerCapture when drag must continue outside the hit area
  • Clear state on both pointerup and pointercancel
  • Prefer click for primary activate actions

❌ Don’t

  • Assume pointerdown equals mousedown for multi-button mice
  • Replace click with pointerdown for primary buttons/links
  • Forget implicit touch capture can change over/leave behavior
  • Ignore cancel paths on mobile / stylus devices
  • Overwrite onpointerdown if you need multiple listeners

Key Takeaways

Knowledge Unlocked

Five things to remember about pointerdown

Pointer became active—one API for mouse, touch, and pen.

5
Core concepts
📄02

PointerEvent

id · type · coords

API
👆03

vs mousedown

first button only

Compare
🔓04

Capture

drag start path

Pattern
🎯05

Baseline

since Jul 2020

Status

❓ Frequently Asked Questions

It fires when a pointer becomes active: for mouse when the first button is pressed, for touch when contact starts, and for 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 (inherits from MouseEvent and Event). Useful fields include pointerId, pointerType, isPrimary, pressure, and width/height.
With a physical mouse, mousedown fires for every button press. pointerdown fires only for the first button; additional buttons held at the same time do not fire more pointerdown events.
On touchscreen browsers that allow direct manipulation, pointerdown can trigger implicit pointer capture so later events target the same element until pointerup or pointercancel (or you call releasePointerCapture).
Prefer it to start unified mouse/touch/pen gestures, drag sessions, and setPointerCapture. Keep primary activate actions on click for keyboard accessibility.
Did you know?

Holding left then right mouse buttons can produce two mousedown events but only one pointerdown (the first button). That is the same multi-button rule MDN highlights when comparing mouse and pointer models.

Next: pointerenter

Learn the non-bubbling event when a pointer enters an element.

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.

5 people found this page helpful