The mouseout event fires when the pointer leaves an element (bound with .on("mouseout") since jQuery 1.7). It bubbles — leaving a child also notifies the parent. Pair historically with mouseover; for nested UI prefer mouseleave / mouseenter.
Remember
$("#outer").on("mouseout", function (event) { … })
bubbles: parent → fires when leaving OR entering a child
mouseleave: fires only when exiting the element entirely
event.relatedTarget → element the pointer moved to
.trigger("mouseout") → run handlers manually
Bind a leave handler, account for bubbling, and prefer mouseleave when nesting matters.
Select the element that should react when the pointer leaves.
Bind with .on("mouseout", handler).
If children exist, check event.relatedTarget — or switch to mouseleave.
Unbind with .off("mouseout") when the feature is done.
Piece
Required?
Role
Element
Yes
Receives leave (and child-crossing) events
handler
Yes
function(event) { … }
eventData
Optional
Object passed as event.data
Return
—
jQuery object (chainable)
Pseudocode
Pseudocode
on mouseout of #outer:
to = event.relatedTarget // where the pointer went
// Bubbling case: Outer → Inner still fires mouseout on Outer
if to is still inside #outer:
optionally ignore // or use mouseleave instead
else:
run leave logic (hide menu, remove class, …)
Reference
Cheat Sheet
Keep these facts handy when handling pointer leave.
Topic
Detail
Bind
.on("mouseout", handler) (1.7+)
Trigger
.trigger("mouseout") (1.0+)
Bubbles?
Yes — child crossings notify the parent
vs mouseleave
mouseleave ignores child crossings
relatedTarget
Element the pointer moved into
Legacy pair
mouseover + mouseout
Shorthand
.mouseout() deprecated — use .on()
Try it
Live Preview
Move between Outer and Inner. Watch how often mouseout fires compared with mouseleave.
Outer
Official idea: mouseout re-fires on child crossings; mouseleave does not.
Result
mouseout count: 0
mouseleave count: 0
Move in/out of Outer and Inner
Code
jQuery Examples
Short, copy-ready snippets. Open each Try It Yourself lab for a live editor.
Example 1 — Bind Handler on #outer
Official pattern: log when the pointer leaves the outer element — including into a child.
jQuery
$("#outer").on("mouseout", function () {
$("#log").append("Handler for mouseout called.\n");
});
Leave Outer → Handler for mouseout called.
Outer → Inner → Handler for mouseout called.
How It Works
Bind the event..on("mouseout", fn) registers the handler on #outer.
Leave the element. Exiting to the page runs the function.
Cross into a child. Moving Outer → Inner also fires because of bubbling.
Expect many calls. Nested content produces more leave events than mouseleave.
Example 2 — Trigger from Another Element
Click a button to fire the same handler with .trigger("mouseout").
jQuery
$("#outer").on("mouseout", function () {
$("#log").append("Handler for mouseout called.\n");
});
$("#other").on("click", function () {
$("#outer").trigger("mouseout");
});
Leave Outer → Handler for mouseout called.
Click button → Handler for mouseout called.
How It Works
Same handler. Real leaves and triggers both call the bound function.
Synthetic event..trigger("mouseout") runs handlers without a real pointer move.
Bubbling still applies. Use .triggerHandler("mouseout") to avoid bubble side effects.
Useful for tests. Simulate leave logic without moving the mouse.
Example 3 — mouseout vs mouseleave
Official comparison: count leave events on nested boxes — adapted from the jQuery API demo.
jQuery
var i = 0;
$(".overout").on("mouseout", function () {
$("span", this).text(++i);
});
var n = 0;
$(".enterleave").on("mouseleave", function () {
$("span", this).text(++n);
});
Check these before closing menus or tooltips with mouseout.
bubble
Child crossings look like exits
Outer → Inner fires mouseout on Outer. Menus can collapse mid-hover.
prefer
Use mouseleave for nested UI
Official guidance: see mouseleave for a stable alternative to bubbling leave events.
null
relatedTarget can be null
Leaving the window or some synthetic triggers leave it empty — guard before calling methods on it.
css
Prefer CSS :hover for style-only
If you only change colors or visibility, CSS avoids JS leave bugs entirely.
deprecated
.mouseout() shorthand
Deprecated since 3.3 — bind with .on("mouseout") instead.
Compatibility
Browser Support
The mouseout event is a standard DOM mouse event. jQuery’s .on("mouseout") (since 1.7) works in any browser where your jQuery build runs.
✓ jQuery 1.7+ · Browsers
jQuery mouseout event
Supported wherever jQuery runs — Chrome, Firefox, Safari, Edge, and legacy environments with a matching jQuery build.
100%With jQuery loaded
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
mouseoutBrowsers
Bottom line: Safe in all common browsers with jQuery loaded. Prefer .on() / .off() over the deprecated .mouseout() shorthand.
Analysis
Performance Notes
Approach
Cost
Best for
mouseout on nested trees
More handler calls
Legacy / flat targets only
mouseleave
Fewer leave calls
Menus, tooltips, cards with children
relatedTarget filter
Small closest() check
Keeping mouseout without flicker
Bubbling leave events are not “slow” by themselves — but extra handler runs (class toggles, DOM writes) add up. Prefer mouseleave when nesting is deep.
Remember
Key Takeaways
Role: run logic when the pointer leaves an element.
Bubbles: child crossings notify the parent — unlike mouseleave.
Filter: use event.relatedTarget or switch to mouseleave.
API: prefer .on("mouseout"), not the deprecated .mouseout() shorthand.
One line:mouseout leaves and bubbles — reach for mouseleave when nesting matters.
Frequently Asked Questions
mouseout fires when the pointer leaves an element. Bind with .on('mouseout', handler) (since jQuery 1.7). Unlike mouseleave, it bubbles — it also fires when moving from a parent into a child inside the bound element.
When the pointer leaves a child, mouseout bubbles to ancestors. A handler on an outer menu can fire even though the user is still inside the menu. Prefer mouseleave for nested menus, or filter with event.relatedTarget.
relatedTarget is the element the pointer moved to. If it is still inside the bound element, you can ignore the event: if ($(event.relatedTarget).closest('#outer').length) return;
mouseout bubbles and re-fires on child boundary crossings. mouseleave fires only when the pointer exits the bound element entirely. For hover menus and tooltips with nested content, prefer mouseleave with mouseenter.
Call .trigger('mouseout') on the element. Use .triggerHandler('mouseout') to run handlers without bubbling.
Use .on('mouseout', handler). The .mouseout() shorthand is deprecated since jQuery 3.3. Unbind with .off('mouseout').