jQuery mouseenter Event — Enter Without Child Bubbling

Beginner
5 min read
Updated: Nov 2026
3 examples
Mouse Events

Definition

mouseenter fires when the pointer enters the element it is bound to. Moving into a child does not fire it again (unlike mouseover). Bind with .on("mouseenter", handler) (jQuery 1.7+).

Syntax

Start with these common calls. Keep them short and readable.

jQuery
$("#outer").on("mouseenter", function () { ... })
$("#outer").trigger("mouseenter")

// Enter element → fires once
// Enter a child inside it → does NOT fire again
// Prefer on/trigger — not the deprecated .mouseenter()
CallWhat it does
mouseenterLearn the jQuery mouseenter event: bind with .on(\

Load jQuery before your script (CDN or local file), then wrap DOM work in $(function () { ... }) when needed.

Parameters

ParameterDescription
Step 1Select the element(s): $("#outer"), $(".card"), etc.
Step 2Bind: .on("mouseenter", function (event) { ... }).
Step 3Pair with .on("mouseleave", …) for hover-style UI.

Return Value

Return ValueDescription
jQuery objectMost setters and traversing helpers return the jQuery collection so you can chain more methods.

jQuery Examples

Example 1 — Bind a mouseenter Handler

Official style: .on("mouseenter", …) on a container.

jQuery
$("#outer").on("mouseenter", function () {
  console.log("Handler for mouseenter called.");
});
Try It Yourself

How It Works

  1. Select #outer.
  2. Bind with .on("mouseenter", handler).
  3. Pointer enters the element from outside.

Example 2 — Trigger mouseenter from Code

Fire the same handlers with a click on another control.

jQuery
$("#outer").on("mouseenter", function () {
  console.log("Handler for mouseenter called.");
});

$("#other").on("click", function () {
  $("#outer").trigger("mouseenter");
});
Try It Yourself

How It Works

  1. Bind the real handler on #outer.
  2. Another control listens for click.
  3. trigger("mouseenter") runs #outer’s handlers.

Example 3 — mouseenter vs mouseover

Entering a child re-fires mouseover, not mouseenter.

jQuery
var enterCount = 0;
var overCount = 0;

$("#enterBox").on("mouseenter", function () {
  enterCount += 1;
  console.log("mouseenter:", enterCount);
});

$("#overBox").on("mouseover", function () {
  overCount += 1;
  console.log("mouseover:", overCount);
});
// Move into each box, then into its Inner child:
// mouseenter stays 1; mouseover increases again.
Try It Yourself

How It Works

  1. mouseenter counts only entering the bound box.
  2. mouseover also fires when you enter the Inner child.
  3. Choose mouseenter for stable hover on parents with children.

Frequently Asked Questions

mouseenter fires when the pointer enters the bound element. Unlike mouseover, moving into a child does not fire it again. Bind with .on("mouseenter", handler) (jQuery 1.7+). jQuery simulates the event across browsers.
Prefer .on("mouseenter", handler). The .mouseenter(handler) shorthand is deprecated since jQuery 3.3. To fire the event, use .trigger("mouseenter") instead of .mouseenter().
mouseover bubbles and also fires when the pointer moves from parent into a child. mouseenter does not — it fires once when entering the element it is bound to, not when entering descendants.
Use mouseleave for when the pointer leaves the element (same non-child-bubbling behavior). .hover(enterFn, leaveFn) is a convenience that wires both.
Call $(selector).trigger("mouseenter"). That runs bound handlers without needing a real pointer move.
No — that is the point versus mouseover. Handlers on an ancestor are not triggered by entering a descendant of the bound element.

Next: .mouseenter() Method — Deprecated Shorthand

See the deprecated method form — then keep using .on / .trigger.

.mouseenter() Method — Deprecated Shorthand tutorial →

CODETOFUN NEWS

Stay Ahead in Tech

Get the latest IT news, programming updates, and technology trends directly on your phone.

Your daily dose of tech, straight to your feed.

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.

8 people found this page helpful