HTMLElement: pointerenter event
The pointerenter
event fires when a pointing device is moved into the hit test boundaries of an element or one of its descendants, including as a result of a pointerdown
event from a device that does not support hover (see pointerdown
).
Bubbles | No |
---|---|
Cancelable | No |
Interface | PointerEvent |
Event handler property | onpointerenter |
Examples
Using addEventListener()
:
const para = document.querySelector('p');
para.addEventListener('pointerenter', (event) => {
console.log('Pointer entered element');
});
Using the onpointerenter
event handler property:
const para = document.querySelector('p');
para.onpointerenter = (event) => {
console.log('Pointer entered element');
};
Specifications
Specification |
---|
Pointer Events # the-pointerenter-event |
Browser compatibility
BCD tables only load in the browser
See also
gotpointercapture
lostpointercapture
pointerover
pointerdown
pointermove
pointerup
pointercancel
pointerout
pointerleave
onpointerenter
event handler property- This event on
Document
targets:pointerenter
event