jQuery mouseleave Event — Leave Without Child Bubbling
Beginner
5 min read
Updated: Oct 2026
4 examples
Live preview
Definition
What Is the mouseleave Event?
mouseleave fires when the pointer leaves the element it is bound to. Leaving a child does not fire it (unlike mouseout). Bind with .on("mouseleave", handler) (jQuery 1.7+).
Remember
$("#outer").on("mouseleave", function () { ... })
$("#outer").trigger("mouseleave")
// Leave element → fires once
// Leave a child but stay inside element → does NOT fire
// Prefer on/trigger — not the deprecated .mouseleave()
Select the container, bind leave (and usually enter), avoid mouseout when children would spam handlers.
Select the element(s): $("#outer"), $(".card"), etc.
Bind: .on("mouseleave", function (event) { ... }).
Pair with .on("mouseenter", …) for hover-style UI.
To fire in code: .trigger("mouseleave"). Unbind with .off("mouseleave").
Piece
Required?
Role
"mouseleave"
Yes
Event type string for .on / .trigger
handler
Yes (bind)
Runs when the pointer leaves the element
eventData
Optional
Extra data passed into the handler
Return value
—
jQuery set (chainable)
Pseudocode
Pseudocode
function onMouseleave(element, handler):
when pointer moves from inside element → outside element:
handler(event)
// leaving a child but staying inside element does NOT call handler
trigger(element, "mouseleave"):
run all mouseleave handlers on element
Reference
Cheat Sheet
Keep these facts handy when choosing leave vs out.
Handler runs once for that leave — not when leaving children only.
Example 2 — Trigger mouseleave from Code
Fire the same handlers with a click on another control.
jQuery
$("#outer").on("mouseleave", function () {
console.log("Handler for mouseleave called.");
});
$("#other").on("click", function () {
$("#outer").trigger("mouseleave");
});
Leaving a child re-fires mouseout, not mouseleave.
jQuery
var leaveCount = 0;
var outCount = 0;
$("#leaveBox").on("mouseleave", function () {
leaveCount += 1;
console.log("mouseleave:", leaveCount);
});
$("#outBox").on("mouseout", function () {
outCount += 1;
console.log("mouseout:", outCount);
});
// Leave each box entirely, and also leave Inner while staying in the box:
// mouseleave stays 1 for full leave; mouseout increases on Inner too.
Most bugs come from using mouseout when you meant mouseleave.
children
Do not use mouseout for parent hover
Nested elements re-fire mouseout. Prefer mouseenter / mouseleave for cards and menus.
deprecated
Avoid .mouseleave() in new code
Use .on("mouseleave") / .trigger("mouseleave"). The method shorthand is deprecated since 3.3.
touch
No true hover on touch
Pointer enter/leave is mouse-oriented. Provide click/tap paths for touch UIs.
simulate
jQuery normalizes the event
Originally IE-only; jQuery simulates mouseleave so it works in all supported browsers.
Compatibility
Browser Support
.on("mouseleave") has shipped since jQuery 1.7 (.trigger("mouseleave") since 1.0). jQuery simulates mouseleave so it works in all modern browsers with jQuery loaded.
✓ jQuery 1.7+
mouseleave event
Pointer leaves the bound element — without re-firing on child elements.
100%Browser support
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
mouseleaveExcellent
Bottom line: Bind with .on("mouseleave"). Prefer it over mouseout when the element has children.
Analysis
Performance Notes
Approach
Cost
Best for
mouseleave
Fewer calls
Parent hover cleanup with children
mouseout
More calls
When you truly need child leaves
Heavy work in handler
Janky hover
Keep enter/leave light
Prefer mouseenter / mouseleave for UI hover — fewer accidental re-entries means less work and cleaner state.
Remember
Key Takeaways
Role: pointer leaves the bound element.
vs out: children do not re-fire mouseleave.
API: use .on / .trigger, not the shorthand.
Pair:mouseenter or .hover().
One line:.on("mouseleave") for leave-once hover cleanup — use it when the element has children.
Frequently Asked Questions
mouseleave fires when the pointer leaves the bound element. Unlike mouseout, moving out of a child into another part of the same parent does not fire it. Bind with .on("mouseleave", handler) (jQuery 1.7+). jQuery simulates the event across browsers.
Prefer .on("mouseleave", handler). The .mouseleave(handler) shorthand is deprecated since jQuery 3.3. To fire the event, use .trigger("mouseleave") instead of .mouseleave().
mouseout bubbles and also fires when the pointer leaves a child for another descendant or the parent. mouseleave does not — it fires only when leaving the element it is bound to, not when leaving a descendant.
Use mouseenter for when the pointer enters the element (same non-child-bubbling behavior). .hover(enterFn, leaveFn) is a convenience that wires both.
Call $(selector).trigger("mouseleave"). That runs bound handlers without needing a real pointer move.
No — that is the point versus mouseout. Leaving a child does not trigger a mouseleave handler bound only on the parent.