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. Otherwise, pointerleave works the same as mouseleave, and are dispatched at the same time. They are also dispatched at the same time as mouseout and pointerout events, if appropriate.
Use the event name in methods like addEventListener(), or set an event handler property.
addEventListener("pointerleave", (event) => { })
onpointerleave = (event) => { }A PointerEvent. Inherits from Event.
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");
};