Example 1 — Bind with .mouseover(handler)
Log enter events with the deprecated binding shorthand — child crossings also fire.
$("#outer").mouseover(function () {
$("#log").append("Handler for mouseover called.\n");
});
// Prefer: $("#outer").on("mouseover", function () { … }); How It Works
- Pass a function.
.mouseover(fn)registers the handler (deprecated). - Enter the element. Arriving from outside runs the function.
- Cross into a child. Outer → Inner also fires because mouseover bubbles.
- Migrate. Swap to
.on("mouseover", fn)— ormouseenterfor nesting.

