files/en-us/web/api/element/pointerdown_event/index.md
{{APIRef("Pointer Events")}}
The pointerdown event is fired when a pointer becomes active. For mouse, it is fired when the device transitions from no buttons pressed to at least one button pressed. For touch, it is fired when physical contact is made with the digitizer. For pen, it is fired when the stylus makes physical contact with the digitizer.
This behavior is different from {{domxref("Element/mousedown_event", "mousedown")}} events. When using a physical mouse, mousedown events fire whenever any button on a mouse is pressed down. pointerdown events fire only upon the first button press; subsequent button presses don't fire pointerdown events.
[!NOTE] For touchscreen browsers that allow direct manipulation, a
pointerdownevent triggers implicit pointer capture, which causes the target to capture all subsequent pointer events as if they were occurring over the capturing target. Accordingly,pointerover,pointerenter,pointerleave, andpointeroutwill not fire as long as this capture is set. The capture can be released manually by calling {{domxref('element.releasePointerCapture')}} on the target element, or it will be implicitly released after apointeruporpointercancelevent.
Use the event name in methods like {{domxref("EventTarget.addEventListener", "addEventListener()")}}, or set an event handler property.
addEventListener("pointerdown", (event) => { })
onpointerdown = (event) => { }
A {{domxref("PointerEvent")}}. Inherits from {{domxref("Event")}}.
{{InheritanceDiagram("PointerEvent")}}
This interface inherits properties from {{domxref("MouseEvent")}} and {{domxref("Event")}}.
PointerEvent.0 to 1, where 0 and 1 represent the minimum and maximum pressure the hardware is capable of detecting, respectively.-1 to 1, where 0 is the neutral position of the control.-90 to 90) between the Y–Z plane and the plane containing both the pointer (e.g., pen stylus) axis and the Y axis.-90 to 90) between the X–Z plane and the plane containing both the pointer (e.g., pen stylus) axis and the X axis.0 to 359.Using addEventListener():
const para = document.querySelector("p");
para.addEventListener("pointerdown", (event) => {
console.log("Pointer down event");
});
Using the onpointerdown event handler property:
const para = document.querySelector("p");
para.onpointerdown = (event) => {
console.log("Pointer down event");
};
{{Specifications}}
{{Compat}}