HTMLElement: pointerleave event

The pointerleave event is fired when a pointing device is moved out of the hit test boundaries of an element. For pen devices, this event is fired when the stylus leaves the hover range detectable by the digitizer.

Bubbles No
Cancelable No
Interface PointerEvent
Event handler property onpointerleave

Examples

Using addEventListener():

const para = document.querySelector('p');

para.addEventListener('pointerleave', (event) => {
  console.log('Pointer left element');
});

Using the onpointerleave event handler property:

const para = document.querySelector('p');

para.onpointerleave = (event) => {
  console.log('Pointer left element');
};

Specifications

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
pointerleave_event
55
12
12-79
59
29
11
10
42
13
55
55
79
29
42
13
6.0

See also

© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/pointerleave_event