Home

pointerId

PointerId is a numeric identifier used by the Pointer Events API to distinguish individual input pointers, such as mouse, pen, and touch contacts, within a single document. It is exposed as the pointerId property of PointerEvent objects and uniquely identifies the pointer that caused a sequence of events.

The value is stable for the duration of a pointer’s contact with the surface. All events belonging

PointerId is scoped to the current document and session. It is not guaranteed to be persistent across

Practical uses include tracking multiple concurrent pointers to implement multi-touch gestures, dragging operations, or gesture recognition.

Compatibility notes: pointerId is part of the Pointer Events API, supported in modern browsers. Some older environments

to
the
same
pointer
(for
example,
a
finger
touching
and
then
moving
across
a
touch
surface)
carry
the
same
pointerId,
while
different
pointers
receive
different
IDs.
In
practice,
new
pointers
are
assigned
new
IDs,
often
starting
from
1
and
incrementing
with
each
new
contact;
the
exact
sequence
is
implementation
dependent.
page
reloads,
cross-origin
contexts,
or
device
changes.
It
should
not
be
used
as
a
persistent
reference
to
a
user
or
device,
but
rather
as
a
runtime
handle
for
coordinating
multiple
simultaneous
pointers
within
a
single
page.
pointerId
is
also
required
for
pointer
capture,
where
an
element
can
receive
pointer
events
even
when
the
pointer
moves
outside
the
element’s
hit
area
by
calling
setPointerCapture(pointerId).
rely
on
legacy
touch
or
mouse
events;
feature
detection
is
recommended
when
targeting
older
platforms.