jQuery mouseout to handle mouse moves out event

jQuery mouseout to handle mouse moves out event

jQuery mouseout binds handler to execute functionalities when mouse moves out of the binded element.

<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <title>jQuery mouse out event handler</title>
    <script src="https://code.jquery.com/jquery-1.10.2.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("div").mouseout(function () {
                $(this).text("mouse is out of div!");
            });
        });
    </script>
</head>
<body>
    <div style="height:200px;width:200px;background-color:blue;color:white">
        Mouse move in this area
    </div>
</body>
</html>
Output:
no mouse move output
mouse moves out event output

Move the mouse to out of the div "Move mouse in this area" to update text of div as 'mouse is out of div!'.

jQuery mouseleave event handler

In jQuery, mouseleave event handler is also useful to do the functionalities when leave the mouse out of the binded element.

        $(document).ready(function () {
            $("div").mouseleave(function () {
                $(this).text("mouse is inside of div!");
            });
        });

Privacy Policy  |  Copyrightcopyright symbol2020 - All Rights Reserved.  |  Contact us   |  Report website issues in Github   |  Facebook page   |  Google+ page

Email Facebook Google LinkedIn Twitter
^