jQuery Mouse Enter and Leave Events

mouseenter runs when the pointer enters an element and mouseleave runs when it leaves. They are useful when you want clear entry and exit behavior without repeated triggers from child elements.

mouseenter Syntax Top ↑

$( selector ).on( "mouseenter", function () {
    // Pointer entered.
});

mouseleave Syntax Top ↑

$( selector ).on( "mouseleave", function () {
    // Pointer left.
});

Handle Entry and Exit Top ↑

$( function () {
    $( "#t123" ).on( "mouseenter", function () {
        $( "#d1" ).text( "Mouse entered the area" );
    });

    $( "#t123" ).on( "mouseleave", function () {
        $( "#d1" ).text( "Mouse left the area" );
    });
});

Example HTML Top ↑

<textarea id="t123" rows="4" cols="60">
Bring your mouse inside this area and then take it out.
</textarea>
<div id="d1"></div>

Open the mouse-event demo →

Mouse Events with jQuery






plus2net.com






✖
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
© 2000-2026 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer