Web APIs

PointerEvent.pointerType

Try the free JavaScript compiler

String describing the pointer device type, such as mouse, pen or touch, or empty if unknown.

Formal Syntax & Structure

javascript syntaxjavascript
event.pointerType

Return Value

string

Pointer device category.

Working Example

Example Snippetjavascript
const e=new PointerEvent("pointerdown",{pointerType:"pen",pointerId:8});console.log(e.pointerType,e.pointerId);
JavaScript Reference