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

01

.mouseover(fn)

Bind handler

02

eventData

Since 1.4.3

03

.mouseover()

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(), .mouseover(), .keydown(), and dozens more. The .mouseover() method let you bind a hover-enter handler in one short call: $("#menu").mouseover(function(){ ... }). It remains in jQuery 3.x for backward compatibility but is marked deprecated.

Understanding .mouseover() 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 mouseenter, the mouseover event bubbles — a handler on #outer fires when the pointer enters an inner child, not only when crossing the outer boundary from outside. Modern jQuery splits binding and triggering explicitly — .on("mouseover", handler) for binding and .trigger("mouseover") for firing. This page documents the shorthand API and shows how to migrate.

Understanding the .mouseover() Method

The official jQuery API describes .mouseover() as a way to bind an event handler to the mouseover 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 enters that element — including when the pointer moves from the element into a nested child inside it, because mouseover bubbles.

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

⚠️
Deprecated since jQuery 3.3

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

📝 Syntax

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

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

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

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

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

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

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

Official jQuery API migration note

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

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

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

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

Return value

  • All .mouseover() 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 (.mouseover)Modern replacement
Bind mouseover handler$("#box").mouseover(fn)$("#box").on("mouseover", fn)
Pass data to handler$("#box").mouseover({ action: "show" }, fn)$("#box").on("mouseover", { action: "show" }, fn)
Pair over and out (legacy).mouseover(fnIn).mouseout(fnOut) — also deprecated; beware bubbling on nested content
Trigger mouseover programmatically$("#outer").mouseover()$("#outer").trigger("mouseover")
Remove mouseover handlers$("#box").off("mouseover")
Prefer for nested menus$("#nav").on("mouseenter", fn) instead of mouseover
Filter child crossingsif ($(event.relatedTarget).closest("#outer").length) return;

📋 .mouseover() vs .on("mouseover") vs .trigger("mouseover") vs mouseenter

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

.mouseover()
deprecated

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

.on("mouseover")
bind

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

.trigger("mouseover")
fire

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

mouseenter
no bubble

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

Examples Gallery

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

📚 Binding & Triggering

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

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

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

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

How It Works

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

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

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

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

How It Works

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

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

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

jQuery
var count = 0;

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

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

How It Works

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

📈 Migration & Legacy Hover Pair

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

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

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

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

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

How It Works

Under the hood, .mouseover(fn) calls .on("mouseover", fn). Migration is a straight rename with no behavior change for simple bindings. The advantage of .on() is delegation — $("#menu").on("mouseover", "li", fn) — which .mouseover() 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").mouseover(fn) as equivalent to .on("mouseover", 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").mouseover(); }) — replace inner no-arg .mouseover() with .trigger("mouseover").
  • Shared eventData$(".tip").mouseover({ action: "show" }, fn) passes metadata without closures.
  • Flat row highlight$("tr").mouseover(fn) on table rows with no nested interactive elements.
  • Automated testing — test suites may call .mouseover() to simulate enter — consider .trigger("mouseover") for explicit intent.

🧠 How .mouseover() Routes Through jQuery

1

You call .mouseover()

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

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

.on("mouseover")
3

Trigger path

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

.trigger("mouseover")
4

jQuery object returned

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

📝 Notes

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

Browser Support

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

jQuery 1.0+

jQuery .mouseover() method

Supported across all jQuery versions you are likely to maintain. Deprecated binding since 3.3 — use .on('mouseover') for new projects. Native equivalent for binding: element.addEventListener('mouseover', 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
.mouseover() Legacy API

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

Conclusion

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

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

💡 Best Practices

✅ Do

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

❌ Don’t

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

Key Takeaways

Knowledge Unlocked

Six things to remember about .mouseover()

Legacy bind, modern migrate.

6
Core concepts
data 02

eventData

Since 1.4.3

Handler
() 03

.mouseover()

Trigger

No args
bubble 04

Bubbles

Child crosses

Caution
.on 05

.on("mouseover")

Modern

Replace
3.3 06

Deprecated

Since 3.3

Migrate

❓ Frequently Asked Questions

The .mouseover() method has two roles. With a handler argument — .mouseover(handler) or .mouseover(eventData, handler) — it binds a function that runs when the pointer enters the matched element or moves from the element into a nested child (because mouseover bubbles). With no arguments — .mouseover() — it triggers the mouseover 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 .mouseover(handler) and .mouseover(eventData, handler) are deprecated since jQuery 3.3. Use .on('mouseover', handler) or .on('mouseover', eventData, handler) instead. The no-argument .mouseover() trigger form still works but .trigger('mouseover') is clearer and preferred in modern code. Existing legacy code continues to run in jQuery 3.x; migrate when you touch those files.
.mouseover(handler) registers a callback — it does not fire the event immediately. .mouseover() with no arguments triggers the mouseover event programmatically on every matched element, the same as .trigger('mouseover'). 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 mouseover event bubbles. When the pointer moves from the outer element's surface into a child inside it, the browser fires mouseover on the child and the event bubbles up to the outer element. That is why .mouseover(fn) on a menu container fires again even though the user is still inside the menu. For nested menus and tooltips, prefer .on('mouseenter', fn) instead — mouseenter does not bubble and ignores child crossings.
Replace .mouseover(fn) with .on('mouseover', fn). Replace .mouseover(data, fn) with .on('mouseover', data, fn). Replace no-arg .mouseover() with .trigger('mouseover'). Replace .unbind('mouseover') cleanup with .off('mouseover'). Under the hood, .mouseover(handler) already delegates to .on('mouseover') — migration is a straight rename with no behavior change for simple bindings.
Yes. jQuery 3.x keeps .mouseover() 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 .mouseover(handler) in new code — prefer the modern API covered in the jQuery mouseover event tutorial.
Did you know?

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

Next: .addClass() Method

Add CSS classes on hover — the natural follow-up to legacy mouseover handlers.

.addClass() 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