jQuery .mouseenter() 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 .mouseenter() method is jQuery’s legacy shorthand for binding and triggering the mouseenter event. This tutorial covers .mouseenter(handler) since 1.0, .mouseenter(eventData, handler) since 1.4.3, no-argument .mouseenter() as a trigger, migration to .on("mouseenter") and .trigger("mouseenter"), and why the binding form is deprecated since jQuery 3.3. For the modern mouseenter event API, see the jQuery mouseenter event tutorial.

01

.mouseenter(fn)

Bind handler

02

eventData

Since 1.4.3

03

.mouseenter()

Trigger event

04

.on()

Modern bind

05

.trigger()

Modern fire

06

Deprecated

Since 3.3

Introduction

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

Understanding .mouseenter() matters when reading older dropdown menus, tooltip plugins, and legacy tutorials. The method does two distinct jobs: with a function argument it binds; with no arguments it triggers. Modern jQuery splits those roles explicitly — .on("mouseenter", handler) for binding and .trigger("mouseenter") for firing. This page documents the shorthand API and shows how to migrate.

Understanding the .mouseenter() Method

The official jQuery API describes .mouseenter() as a way to bind an event handler to the mouseenter 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 — without re-firing when moving over nested children, unlike mouseover.

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

⚠️
Deprecated since jQuery 3.3

Do not use .mouseenter(handler) or .mouseenter(eventData, handler) in new code. Replace them with .on("mouseenter", handler) or .on("mouseenter", eventData, handler). Replace no-argument .mouseenter() with .trigger("mouseenter"). For comparison with mouseover, delegation, and pairing with mouseleave, read the jQuery mouseenter event tutorial.

📝 Syntax

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

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

jQuery
.mouseenter( handler )
  • handler — function executed each time mouseenter fires: function( event ) { ... }.
  • Returns the jQuery object for chaining.
  • Modern replacement: .on( "mouseenter", handler ).

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

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

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

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

Official jQuery API migration note

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

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

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

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

Return value

  • All .mouseenter() 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 (.mouseenter)Modern replacement
Bind mouseenter handler$("#box").mouseenter(fn)$("#box").on("mouseenter", fn)
Pass data to handler$("#box").mouseenter({ id: 1 }, fn)$("#box").on("mouseenter", { id: 1 }, fn)
Pair enter and leave.on("mouseenter", in).on("mouseleave", out) — not via single .mouseenter()
Trigger mouseenter programmatically$("#outer").mouseenter()$("#outer").trigger("mouseenter")
Remove mouseenter handlers$("#box").off("mouseenter")
Delegated mouseenter on children$("#menu").on("mouseenter", "li", fn) — not available via .mouseenter()
Both enter + leave (legacy).hover(fnIn, fnOut) — also deprecated; use .on("mouseenter") / .on("mouseleave")

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

Four related APIs — know which one binds, which one fires, and which one covers both enter and leave.

.mouseenter()
deprecated

Legacy bind (.mouseenter(fn)) or trigger (.mouseenter()) — use modern APIs for new code

.on("mouseenter")
bind

Modern binding since 1.7 — supports eventData and delegation on dynamic menus

.trigger("mouseenter")
fire

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

.hover()
enter+leave

Deprecated shorthand for mouseenter + mouseleave in one call — also migrate to .on()

Examples Gallery

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

📚 Binding & Triggering

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

Example 1 — Bind Handler with .mouseenter(handler)

The canonical legacy pattern — attach a function that runs when the pointer enters the element.

jQuery
$( "#outer" ).mouseenter( function() {
  $( "#log" ).append( " Handler ran via .mouseenter(function(){ ... }). " );
} );
Try It Yourself

How It Works

.mouseenter(fn) registers the function on the element. jQuery internally routes this to .on("mouseenter", fn). The handler runs once when the pointer crosses into the outer boundary.

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

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

jQuery
$( ".preview" ).mouseenter( { panel: "tooltip" }, function( event ) {
  var id = $( this ).data( "id" );
  $( "#log" ).text(
    "Preview: " + id + " | eventData.panel: " + event.data.panel
  );
} );
Try It Yourself

How It Works

jQuery stores the { panel: "tooltip" } object and injects it into event.data when any matched preview link is entered. Modern equivalent: .on("mouseenter", { panel: "tooltip" }, fn).

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

Calling .mouseenter() without a handler fires the mouseenter event programmatically.

jQuery
var count = 0;

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

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

How It Works

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

📈 Migration & Enter/Leave Chaining

Compare legacy and modern APIs, and chain enter with leave handlers.

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

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

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

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

How It Works

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

Example 5 — Chained .mouseenter() and .mouseleave() for Highlight

Legacy pattern — add highlight on enter, remove on leave. Prefer explicit .on("mouseenter") / .on("mouseleave") in new code over deprecated .hover().

jQuery
$( "#card" )
  .mouseenter( function() {
    $( this ).addClass( "highlight" );
    $( "#log" ).text( "Entered — .highlight added via .mouseenter()." );
  } )
  .mouseleave( function() {
    $( this ).removeClass( "highlight" );
    $( "#log" ).text( "Left — .highlight removed via .mouseleave()." );
  } );
Try It Yourself

How It Works

Chaining .mouseenter(fn) and .mouseleave(fn) gives complete hover behavior without the deprecated .hover() wrapper. Both shorthand methods are deprecated — migrate to .on("mouseenter", fn).on("mouseleave", fn).

🚀 Common Use Cases

  • Reading legacy code — recognize $("#menu").mouseenter(fn) as equivalent to .on("mouseenter", fn) in older dropdown plugins.
  • Tooltip plugins — legacy code often uses .mouseenter(fn) to show tooltips — migrate to .on("mouseenter", fn).
  • Proxy triggers$("#btn").click(function(){ $("#panel").mouseenter(); }) — replace inner no-arg .mouseenter() with .trigger("mouseenter").
  • Shared eventData$(".thumb").mouseenter({ size: "large" }, fn) passes metadata without closures.
  • Enter/leave pairs — chain .mouseenter(fnIn).mouseleave(fnOut) — same pattern as deprecated .hover().
  • Automated testing — test suites may call .mouseenter() to simulate hover — consider .trigger("mouseenter") for explicit intent.

🧠 How .mouseenter() Routes Through jQuery

1

You call .mouseenter()

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

.mouseenter(handler) delegates internally to .on("mouseenter", handler) — the handler is stored in jQuery’s event system.

.on("mouseenter")
3

Trigger path

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

.trigger("mouseenter")
4

jQuery object returned

Both paths return the original collection for chaining — .mouseenter(fn).addClass("ready") works the same as .on("mouseenter", fn).addClass("ready").

📝 Notes

  • Deprecated since jQuery 3.3 — do not use .mouseenter(handler) or .mouseenter(eventData, handler) in new code. Use .on("mouseenter") instead.
  • Bind with .mouseenter(handler) since jQuery 1.0; eventData form since 1.4.3.
  • No-argument .mouseenter() triggers the event since jQuery 1.0 — prefer .trigger("mouseenter").
  • .mouseenter() does not support event delegation — use .on("mouseenter", selector, fn) for dynamic menus.
  • Pair with .mouseleave() or .on("mouseleave") for complete hover — not mouseout.
  • Remove handlers with .off("mouseenter") — not by calling .mouseenter(undefined).
  • Legacy code using .mouseenter() still runs in jQuery 3.x — migrate when you refactor those files.
  • For the full modern mouseenter guide — vs mouseover, delegation, and triggers — see the jQuery mouseenter event tutorial.

Browser Support

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

jQuery 1.0+

jQuery .mouseenter() method

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

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

Conclusion

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

For new code, prefer .on("mouseenter", fn) for binding and .trigger("mouseenter") for programmatic firing. When you encounter .mouseenter() in older projects, recognize it, understand it, and migrate when practical. For comparison with mouseover, delegation, and pairing with mouseleave, continue with the jQuery mouseenter event tutorial.

💡 Best Practices

✅ Do

  • Use .on("mouseenter", handler) for all new enter bindings
  • Pair with .on("mouseleave", handler) — not deprecated .hover()
  • Use .trigger("mouseenter") instead of no-arg .mouseenter()
  • Migrate .mouseenter(fn) to .on("mouseenter", fn) when refactoring legacy files
  • Read the modern mouseenter event tutorial for delegation patterns

❌ Don’t

  • Write new code with deprecated .mouseenter(handler)
  • Assume .mouseenter() supports delegation — it does not
  • Confuse .mouseenter(fn) (bind) with .mouseenter() (trigger)
  • Use mouseover when you mean enter-once behavior on nested content
  • Copy deprecated patterns from old tutorials without modernizing them

Key Takeaways

Knowledge Unlocked

Six things to remember about .mouseenter()

Legacy bind, modern migrate.

6
Core concepts
data 02

eventData

Since 1.4.3

Handler
() 03

.mouseenter()

Trigger

No args
.on 04

.on("mouseenter")

Modern

Replace
05

.trigger()

Fire

Programmatic
3.3 06

Deprecated

Since 3.3

Migrate

❓ Frequently Asked Questions

The .mouseenter() method has two roles. With a handler argument — .mouseenter(handler) or .mouseenter(eventData, handler) — it binds a function that runs when the pointer enters the matched element. With no arguments — .mouseenter() — it triggers the mouseenter 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 .mouseenter(handler) and .mouseenter(eventData, handler) are deprecated since jQuery 3.3. Use .on('mouseenter', handler) or .on('mouseenter', eventData, handler) instead. The no-argument .mouseenter() trigger form still works but .trigger('mouseenter') is clearer and preferred in modern code. Existing legacy code continues to run in jQuery 3.x; migrate when you touch those files.
.mouseenter(handler) registers a callback — it does not fire the event immediately. .mouseenter() with no arguments triggers the mouseenter event programmatically on every matched element, the same as .trigger('mouseenter'). 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.
Replace .mouseenter(fn) with .on('mouseenter', fn). Replace .mouseenter(data, fn) with .on('mouseenter', data, fn). Replace no-arg .mouseenter() with .trigger('mouseenter'). Replace .unbind('mouseenter') cleanup with .off('mouseenter'). Under the hood, .mouseenter(handler) already delegates to .on('mouseenter') — migration is a straight rename with no behavior change for simple bindings.
Yes. jQuery 3.x keeps .mouseenter() 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 .mouseenter(handler) in new code — prefer the modern API covered in the jQuery mouseenter event tutorial.
Since jQuery 1.4.3, you can pass an object as the first argument before the handler. jQuery attaches it to event.data inside the callback — for example, .mouseenter({ panel: 'preview' }, fn) lets fn read event.data.panel. This avoids closures when the same handler serves multiple elements. The modern equivalent is .on('mouseenter', { panel: 'preview' }, fn).
Did you know?

The deprecated .hover(handlerIn, handlerOut) method never introduced a browser "hover" event — it always mapped to mouseenter and mouseleave. That means .mouseenter(handler) is literally half of what .hover() did. When migrating legacy hover code, split .hover(fnIn, fnOut) into .on("mouseenter", fnIn).on("mouseleave", fnOut) — or rename individual .mouseenter(fn) calls to .on("mouseenter", fn).

Next: mouseleave Event

Learn the exit half of hover — hide menus when the pointer leaves.

mouseleave 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