Skip to content
Related Articles

Related Articles

jQuery | mousemove() with Examples
  • Last Updated : 13 Feb, 2019

The mousemove() method is an inbuilt method in jQuery which is used when mouse pointer moves over the selected element.


Parameters: This method accepts single parameter function which is optional. This parameter is used to specify the function to run when the mousemove event is call.

Return Value: This method returns the selected element with the change.

Below method illustrates the mousemove() method in jQuery:


<!DOCTYPE html>
        <title>The mousemove Method</title>
        <script src=
        <!-- jQuery code to show the working of this method -->
            $(document).ready(function() {
                $("p").mousemove(function() {
                    $("div").css("background-color", "lightgreen");
            div {
                width: 380px;
                padding: 20px;
                height: 60px;
                border: 2px solid green;
                font-weight: bold;
                font-size: 20px;
            <!-- move over this text to see the change -->
            <p>Move over this paragraph.</p>

Before moving mouse over the paragraph:

After moving mouse over the paragraph:


My Personal Notes arrow_drop_up
Recommended Articles
Page :