jQuery .mouseout() Method

Beginner
⚠️ Deprecated since 3.3
⏱️ 11 min read
📚 Updated: Jul 2026
🎯 5 Examples
🚀 5 Try-it labs
Mouse events

What You’ll Learn

The .mouseout() method is jQuery’s legacy shorthand for binding and triggering the mouseout event. This tutorial covers .mouseout(handler) since 1.0, .mouseout(eventData, handler) since 1.4.3, no-argument .mouseout() as a trigger, migration to .on("mouseout") and .trigger("mouseout"), and why the binding form is deprecated since jQuery 3.3. Because mouseout bubbles, handlers also fire when moving into nested children — for nested menus, prefer mouseleave. For the modern mouseout event API, see the jQuery mouseout event tutorial.

01

.mouseout(fn)

Bind handler

02

eventData

Since 1.4.3

03

.mouseout()

Trigger event

04

bubbles

Child crosses

05

.on()

Modern bind

06

Deprecated

Since 3.3

Introduction

Before jQuery 1.7 unified events with .on() and .off(), every common event had a matching shorthand — .click(), .mouseout(), .keydown(), and dozens more. The .mouseout() method let you bind a hover-exit handler in one short call: $("#menu").mouseout(function(){ ... }). It remains in jQuery 3.x for backward compatibility but is marked deprecated.

Understanding .mouseout() matters when reading older card hover effects, tooltip plugins, and legacy tutorials. The method does two distinct jobs: with a function argument it binds; with no arguments it triggers. Unlike mouseleave, the mouseout event bubbles — a handler on #outer fires when the pointer moves into an inner child, not only when leaving the outer boundary entirely. Modern jQuery splits binding and triggering explicitly — .on("mouseout", handler) for binding and .trigger("mouseout") for firing. This page documents the shorthand API and shows how to migrate.

Understanding the .mouseout() Method

The official jQuery API describes .mouseout() as a way to bind an event handler to the mouseout event, or trigger that event on an element. When you pass a handler, jQuery registers it on each matched element and calls it when the pointer leaves that element — including when the pointer moves from the element into a nested child inside it, because mouseout bubbles.

When you call .mouseout() with no arguments, jQuery synthetically fires the mouseout event on each matched element. Bound handlers run immediately. This trigger behavior is equivalent to .trigger("mouseout").

⚠️
Deprecated since jQuery 3.3

Do not use .mouseout(handler) or .mouseout(eventData, handler) in new code. Replace them with .on("mouseout", handler) or .on("mouseout", eventData, handler). Replace no-argument .mouseout() with .trigger("mouseout"). For nested menus and tooltips, prefer mouseleave over mouseout. For bubbling, event.relatedTarget filtering, and modern patterns, read the jQuery mouseout event tutorial.

📝 Syntax

The .mouseout() method has three signatures from the official jQuery API. The binding forms are deprecated; the trigger form remains valid but .trigger("mouseout") is preferred:

1. Bind a handler — .mouseout( handler ) (since 1.0, deprecated 3.3)

jQuery
.mouseout( handler )
  • handler — function executed each time mouseout fires: function( event ) { ... }. Use event.relatedTarget to filter child-boundary crossings.
  • Returns the jQuery object for chaining.
  • Modern replacement: .on( "mouseout", handler ).

2. Bind with eventData — .mouseout( [eventData], handler ) (since 1.4.3, deprecated 3.3)

jQuery
.mouseout( [eventData], handler )
  • eventData — optional object available in the handler as event.data.
  • Modern replacement: .on( "mouseout", eventData, handler ).

3. Trigger the event — .mouseout() (since 1.0)

jQuery
.mouseout()
  • No arguments — triggers mouseout on every matched element.
  • Runs bound mouseout handlers.
  • Preferred replacement: .trigger( "mouseout" ).

Official jQuery API migration note

jQuery
// Deprecated binding
$( "#outer" ).mouseout( function() {
  $( "#log" ).append( " Handler for `mouseout` called. " );
} );

// Modern binding
$( "#outer" ).on( "mouseout", function() {
  $( "#log" ).append( " Handler for `mouseout` called. " );
} );

// Deprecated trigger
$( "#outer" ).mouseout();

// Modern trigger
$( "#outer" ).trigger( "mouseout" );

Return value

  • All .mouseout() signatures return the original jQuery object for chaining.
  • Handler return values are ignored unless you use return false (equivalent to preventDefault() + stopPropagation()).

⚡ Quick Reference

GoalLegacy (.mouseout)Modern replacement
Bind mouseout handler$("#box").mouseout(fn)$("#box").on("mouseout", fn)
Pass data to handler$("#box").mouseout({ action: "hide" }, fn)$("#box").on("mouseout", { action: "hide" }, fn)
Pair over and out (legacy).mouseover(fnIn).mouseout(fnOut) — also deprecated; beware bubbling on nested content
Trigger mouseout programmatically$("#outer").mouseout()$("#outer").trigger("mouseout")
Remove mouseout handlers$("#box").off("mouseout")
Prefer for nested menus$("#nav").on("mouseleave", fn) instead of mouseout
Filter child crossingsif ($(event.relatedTarget).closest("#outer").length) return;

📋 .mouseout() vs .on("mouseout") vs .trigger("mouseout") vs mouseleave

Four related APIs — know which one binds, which one fires, and when bubbling makes mouseleave the better choice.

.mouseout()
deprecated

Legacy bind (.mouseout(fn)) or trigger (.mouseout()) — bubbles on child crossings

.on("mouseout")
bind

Modern binding since 1.7 — supports eventData and delegation; still bubbles

.trigger("mouseout")
fire

Programmatically run handlers — clearer than no-arg .mouseout()

mouseleave
no bubble

Preferred for nested menus — fires only when pointer exits the element entirely

Examples Gallery

Five examples cover binding, eventData, triggering, migration from .mouseout() to .on("mouseout"), and the legacy .mouseover() + .mouseout() hover pair. Use the Try-it links to run each snippet in the browser. Remember: binding with .mouseout(handler) is deprecated — these demos show legacy syntax you will encounter in older code.

📚 Binding & Triggering

Legacy .mouseout() signatures for binding handlers and firing events programmatically.

Example 1 — Bind Handler with .mouseout(handler) on #outer

The canonical legacy pattern — attach a function that runs when the pointer leaves the outer element. Because mouseout bubbles, the handler also fires when moving into the Inner child inside #outer.

jQuery
$( "#outer" ).mouseout( function() {
  $( "#log" ).append( " Handler for `mouseout` called. " );
} );
Try It Yourself

How It Works

.mouseout(fn) registers the function on the element. jQuery internally routes this to .on("mouseout", fn). Unlike mouseleave, the handler runs when the pointer crosses from the outer surface into a child — that is the bubbling behavior that makes mouseout unreliable for nested menus.

Example 2 — Pass eventData with .mouseout(eventData, handler)

Since jQuery 1.4.3, pass an object before the handler — it arrives as event.data.

jQuery
$( ".tooltip" ).mouseout( { action: "hide" }, function( event ) {
  var id = $( this ).data( "id" );
  $( "#log" ).text(
    "Hide: " + id + " | eventData.action: " + event.data.action
  );
} );
Try It Yourself

How It Works

jQuery stores the { action: "hide" } object and injects it into event.data when any matched tooltip trigger is left. Modern equivalent: .on("mouseout", { action: "hide" }, fn).

Example 3 — Trigger mouseout with No-Argument .mouseout()

Calling .mouseout() without a handler fires the mouseout event programmatically — triggered here from a click on #fire.

jQuery
var count = 0;

$( "#outer" ).mouseout( function() {
  count++;
  $( "#log" ).text( "Outer handler fired (count: " + count + ")" );
} );

$( "#fire" ).click( function() {
  $( "#outer" ).mouseout();
} );
Try It Yourself

How It Works

The first .mouseout(function(){ ... }) binds a handler on #outer. The second binds on #fire and calls $("#outer").mouseout() with no arguments — that synthetically fires mouseout. Replace with $("#outer").trigger("mouseout") for clarity.

📈 Migration & Legacy Hover Pair

Compare legacy and modern APIs, and highlight cards with deprecated shorthand methods.

Example 4 — Migration: .mouseout(fn) vs .on("mouseout", fn)

Both bind the same mouseout event — .on() is the recommended API for new code.

jQuery
$( "#legacy" ).mouseout( function() {
  $( "#log" ).text( "Legacy: .mouseout(function(){ ... }) — deprecated since jQuery 3.3." );
} );

$( "#modern" ).on( "mouseout", function() {
  $( "#log" ).text( "Modern: .on('mouseout', function(){ ... }) — use this for new code." );
} );
Try It Yourself

How It Works

Under the hood, .mouseout(fn) calls .on("mouseout", fn). Migration is a straight rename with no behavior change for simple bindings. The advantage of .on() is delegation — $("#menu").on("mouseout", "li", fn) — which .mouseout() cannot do.

Example 5 — Legacy Hover: .mouseover() + .mouseout() on Cards

Add highlight on over, remove on out — the classic pre-mouseenter hover pair using deprecated shorthand methods. Works on flat cards; beware nested content inside each card.

jQuery
$( ".card" )
  .mouseover( function() {
    $( this ).addClass( "highlight" );
  } )
  .mouseout( function() {
    $( this ).removeClass( "highlight" );
  } );
Try It Yourself

How It Works

.mouseover(fn) handles the show half; .mouseout(fn) handles the hide half. On simple flat cards without nested children, this pair works fine. When cards contain buttons, icons, or nested spans, moving between those children triggers spurious out/over events — migrate to .on("mouseenter") + .on("mouseleave") for stable behavior. Both shorthand methods are deprecated since jQuery 3.3.

🚀 Common Use Cases

  • Reading legacy code — recognize $("#card").mouseout(fn) as equivalent to .on("mouseout", fn) in older hover plugins.
  • Legacy hover pairs — maintain existing .mouseover() / .mouseout() code on flat elements without nested children.
  • Proxy triggers$("#btn").click(function(){ $("#panel").mouseout(); }) — replace inner no-arg .mouseout() with .trigger("mouseout").
  • Shared eventData$(".tip").mouseout({ action: "hide" }, fn) passes metadata without closures.
  • Flat row highlight$("tr").mouseout(fn) on table rows with no nested interactive elements.
  • Automated testing — test suites may call .mouseout() to simulate exit — consider .trigger("mouseout") for explicit intent.

🧠 How .mouseout() Routes Through jQuery

1

You call .mouseout()

With a function argument, jQuery treats it as a bind request. With no arguments, it treats it as a trigger request.

dispatch
2

Bind path

.mouseout(handler) delegates internally to .on("mouseout", handler) — the handler is stored in jQuery’s event system and fires on leave and child crossings.

.on("mouseout")
3

Trigger path

No-arg .mouseout() delegates to .trigger("mouseout") — bound handlers run on each matched element.

.trigger("mouseout")
4

jQuery object returned

Both paths return the original collection for chaining — .mouseout(fn).hide() works the same as .on("mouseout", fn).hide().

📝 Notes

  • Deprecated since jQuery 3.3 — do not use .mouseout(handler) or .mouseout(eventData, handler) in new code. Use .on("mouseout") instead.
  • Bind with .mouseout(handler) since jQuery 1.0; eventData form since 1.4.3.
  • No-argument .mouseout() triggers the event since jQuery 1.0 — prefer .trigger("mouseout").
  • mouseout bubbles — handlers fire when moving from a parent into a child inside the bound element. For nested menus, prefer mouseleave.
  • .mouseout() does not support event delegation — use .on("mouseout", selector, fn) for dynamic lists.
  • Filter false positives with event.relatedTarget — see the modern mouseout event tutorial.
  • Remove handlers with .off("mouseout") — not by calling .mouseout(undefined).
  • Legacy code using .mouseout() still runs in jQuery 3.x — migrate when you refactor those files.

Browser Support

jQuery simulates the mouseout event in every browser it supports. The .mouseout() method itself is a jQuery API — it works in jQuery 1.x, 2.x, and 3.x. Binding via .mouseout(handler) is deprecated since 3.3 but still functional; triggering via no-arg .mouseout() also remains supported.

jQuery 1.0+

jQuery .mouseout() method

Supported across all jQuery versions you are likely to maintain. Deprecated binding since 3.3 — use .on('mouseout') for new projects. Native equivalent for binding: element.addEventListener('mouseout', fn).

100% With jQuery loaded
Google Chrome All versions · Desktop & Mobile
Full support
Mozilla Firefox All versions · Desktop & Mobile
Full support
Apple Safari All versions · macOS & iOS
Full support
Microsoft Edge All versions · Chromium & Legacy
Full support
Internet Explorer IE 6+ · Legacy environments
Full support
Opera All modern versions
Full support
.mouseout() Legacy API

Bottom line: Safe in legacy jQuery projects. Migrate bindings to .on('mouseout') and triggers to .trigger('mouseout') when updating code. Prefer mouseleave for nested menus.

Conclusion

The jQuery .mouseout() method is the legacy shorthand for binding and triggering mouseout handlers. Use .mouseout(handler) or .mouseout(eventData, handler) to bind — both deprecated since jQuery 3.3. Use no-argument .mouseout() to trigger — equivalent to .trigger("mouseout").

For new code, prefer .on("mouseout", fn) for binding and .trigger("mouseout") for programmatic firing. Because mouseout bubbles, prefer mouseleave for nested menus. When you encounter .mouseout() in older projects, recognize it, understand it, and migrate when practical. For bubbling, event.relatedTarget filtering, and modern patterns, continue with the jQuery mouseout event tutorial.

💡 Best Practices

✅ Do

  • Use .on("mouseout", handler) for all new out bindings
  • Prefer .on("mouseleave", handler) for nested menus and tooltips
  • Filter child crossings with event.relatedTarget when stuck on mouseout
  • Use .trigger("mouseout") instead of no-arg .mouseout()
  • Read the modern mouseout event tutorial for delegation patterns

❌ Don’t

  • Write new code with deprecated .mouseout(handler)
  • Use .mouseout(fn) on menu containers with nested submenus
  • Swap mouseleave for mouseout without understanding bubbling
  • Confuse .mouseout(fn) (bind) with .mouseout() (trigger)
  • Copy deprecated patterns from old tutorials without modernizing them

Key Takeaways

Knowledge Unlocked

Six things to remember about .mouseout()

Legacy bind, modern migrate.

6
Core concepts
data 02

eventData

Since 1.4.3

Handler
() 03

.mouseout()

Trigger

No args
bubble 04

Bubbles

Child crosses

Caution
.on 05

.on("mouseout")

Modern

Replace
3.3 06

Deprecated

Since 3.3

Migrate

❓ Frequently Asked Questions

The .mouseout() method has two roles. With a handler argument — .mouseout(handler) or .mouseout(eventData, handler) — it binds a function that runs when the pointer leaves the matched element or moves from the element into a nested child (because mouseout bubbles). With no arguments — .mouseout() — it triggers the mouseout event on each matched element, running bound handlers. Both forms have been part of jQuery since 1.0; the binding form is deprecated since 3.3.
Yes — the binding signatures .mouseout(handler) and .mouseout(eventData, handler) are deprecated since jQuery 3.3. Use .on('mouseout', handler) or .on('mouseout', eventData, handler) instead. The no-argument .mouseout() trigger form still works but .trigger('mouseout') is clearer and preferred in modern code. Existing legacy code continues to run in jQuery 3.x; migrate when you touch those files.
.mouseout(handler) registers a callback — it does not fire the event immediately. .mouseout() with no arguments triggers the mouseout event programmatically on every matched element, the same as .trigger('mouseout'). The handler form is deprecated for binding; the no-arg form is a trigger shorthand. Always check whether parentheses contain a function before reading legacy jQuery code.
The mouseout event bubbles. When the pointer leaves the outer element's surface to enter a child inside it, the browser fires mouseout on the outer element and the event bubbles up. That is why .mouseout(fn) on a menu container fires even though the user is still inside the menu. For nested menus and tooltips, prefer .on('mouseleave', fn) instead — mouseleave does not bubble and ignores child crossings.
Replace .mouseout(fn) with .on('mouseout', fn). Replace .mouseout(data, fn) with .on('mouseout', data, fn). Replace no-arg .mouseout() with .trigger('mouseout'). Replace .unbind('mouseout') cleanup with .off('mouseout'). Under the hood, .mouseout(handler) already delegates to .on('mouseout') — migration is a straight rename with no behavior change for simple bindings.
Yes. jQuery 3.x keeps .mouseout() for backward compatibility with jQuery 1.x and 2.x codebases. It still binds and triggers correctly. The API docs mark it deprecated to steer new projects toward .on() and .trigger(). Do not use .mouseout(handler) in new code — prefer the modern API covered in the jQuery mouseout event tutorial.
Did you know?

In deprecated .hover(handlerIn, handlerOut), the second argument handlerOut is literally a mouseleave handler — not a mouseout handler. jQuery never created a separate "hover" browser event. When you see legacy code like $("#nav").hover(showMenu, hideMenu), recognize that hideMenu runs on mouseleave, which does not bubble. Older code that chains .mouseover(fnIn).mouseout(fnOut) instead uses the bubbling mouseout event — a common source of flickering menus. Migrating means .on("mouseenter", showMenu).on("mouseleave", hideMenu).

Next: mouseover Event

Understand bubbling enter events — and when to prefer mouseenter instead.

mouseover tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

6 people found this page helpful