Javascript Ajax jQuery Html PHP Example Quiz New MORE
Need a Website Or Web Application.Contact : +91 9437911966 (Whatsapp) Note: Paid Service

jquery mousemove() Method

The mousemove() method is an predefined method in jQuery. It is used when mouse pointer moves over the selected element. It is accept one parameter and it is optional.

Syntax:

$(selector).mousemove(function)

Example:

<!DOCTYPE html>
<html>
    <head>
        <title>The mousemove Method</title>
        <script src=
        "https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js">
        </script>
         
        <!-- jQuery code to show the working of this method -->
        <script>
            $(document).ready(function() {
                $("p").mousemove(function() {
                    $("div").css("background-color", "lightgreen");
                });
                $("p").mouseleave(function() {
                    $("div").css("background-color", "white");
                });
            });
        </script>
        <style>
            div {
                width: 300px;
                padding: 15px;
                height: 50px;
                border: 1px solid orange;
                font-weight: bold;
                font-size: 20px;
            }
        </style>
    </head>
    <body>
        <div>
            <!-- move over this text to see the change -->
            <p>Move over this paragraph.</p>
        </div>
    </body>
</html> 
Run it Yourself »