This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

pointerId

Summary

A unique identifier for the pointer causing the event

Property of dom/PointerEventdom/PointerEvent

Syntax

Note: This property is read-only.

var result = event.pointerId;

Return Value

Returns an object of type unsigned longunsigned long

The unique identifier of the contact for a touch, mouse or pen.

Examples

//  Adds a pointer to the MSGesture object for the red square
function redListener(evt)
{
    if (evt.type == "pointerdown")
    {
        redGesture.addPointer(evt.pointerId);
        return;
    }
    printEvent(evt);
}

Usage

 This identifier must be unique from all other active pointers at the time. A user agent may recycle previously retired values for pointerId from previous active pointers, if necessary.

If the device producing the event is a mouse, then the pointerId must be 1. Device types other than mouse must not have a pointerId of 1.

Attributions