jQuery mouseleave Event — Leave Without Child Bubbling
Beginner
5 min read
Updated: Nov 2026
3 examples
Mouse Events
Definition
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+).
Syntax
Start with these common calls. Keep them short and readable.
jQuery
$("#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()
Call
What it does
mouseleave
Learn the jQuery mouseleave event: bind with .on(\
Load jQuery before your script (CDN or local file), then wrap DOM work in $(function () { ... }) when needed.
Parameters
Parameter
Description
Step 1
Select the element(s): $("#outer"), $(".card"), etc.
Step 2
Bind: .on("mouseleave", function (event) { ... }).
Step 3
Pair with .on("mouseenter", …) for hover-style UI.
Return Value
Return Value
Description
jQuery object
Most setters and traversing helpers return the jQuery collection so you can chain more methods.
jQuery Examples
Example 1 — Bind a mouseleave Handler
Official style: .on("mouseleave", …) on a container.
jQuery
$("#outer").on("mouseleave", function () {
console.log("Handler for mouseleave called.");
});
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.
mouseout also fires when you leave the Inner child.
Choose mouseleave for stable hover cleanup on parents with 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.