In JavaScript, the mouseleave event fires when a pointing device moves out of an element and all of its descendants (MDN). Paired with mouseenter, it acts much like leaving CSS :hover. The event type is a MouseEvent.
Register a listener with addEventListener. Check readiness and browser support before you rely on this event.
Stay inside children. State stays hovered (no leave yet).
Leave.mouseleave resets to idle.
Use case. Hide tooltips, close hover menus, clear highlights.
Compatibility
Browser Support
Element mouseleave is Baseline Widely available (MDN: since July 2015). Safe for hover cleanup UI in modern and older evergreen browsers.
✓ Baseline · Widely available
Element mouseleave
MouseEvent when the pointer leaves an element — long-established across browsers.
99%Widely available
Google ChromeSupported · Desktop & Mobile
Full support
Mozilla FirefoxSupported · Desktop & Mobile
Full support
Apple SafariSupported · macOS & iOS
Full support
Microsoft EdgeSupported · Chromium
Full support
Internet ExplorerNo native support · Use a polyfill
Polyfill
OperaSupported · Modern versions
Full support
Samsung InternetSupported · Android
Full support
Android WebViewSupported · Modern WebView
Full support
mouseleaveBaseline
Bottom line: Use mouseenter + mouseleave for simple hover on one element. Prefer mouseout only when you need bubbling among descendants.
Frequently Asked Questions
It fires when a pointing device moves out of an element and all of its descendants (MDN). Combined with mouseenter, it behaves a lot like leaving CSS :hover for that element.
No. MDN marks Element mouseleave as Baseline Widely available (since July 2015). It is not Deprecated, Experimental, or Non-standard.
A MouseEvent. Useful fields include clientX, clientY, relatedTarget, and modifier keys.
mouseleave does not bubble and fires only when the pointer has left the element and all descendants. mouseout bubbles and also fires when moving from the element into a descendant.
It follows the element’s position in the DOM tree. Moving into a visually nested sibling can still fire mouseleave on the outer element (MDN).
No. MDN notes that mouseleave and mouseout are not triggered when the element is replaced or removed from the DOM.