jQuery | mousemove() with Examples
The mousemove() method is an inbuilt method in jQuery which is used when mouse pointer moves over the selected element.
Syntax:
$(selector).mousemove(function)
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:
Example:
<!DOCTYPE html> <html> <head> <title>The mousemove Method</title> <script src= </script> <!-- jQuery code to show the working of this method --> <script> $(document).ready(function() { $("p").mousemove(function() { $("div").css("background-color", "lightgreen"); }); }); </script> <style> div { width: 380px; padding: 20px; height: 60px; border: 2px solid green; 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> |
Output:
Before moving mouse over the paragraph:

After moving mouse over the paragraph:

Recommended Posts:
- jQuery | has() with Examples
- jQuery | after() with Examples
- jQuery | last() with Examples
- jQuery | first() with Examples
- jQuery | on() with Examples
- jQuery | val() with Examples
- jQuery | eq() with Examples
- jQuery | one() with Examples
- jQuery | ready() with Examples
- jQuery | andSelf( ) with Examples
- jQuery | scroll() with Examples
- jQuery | resize() with Examples
- jQuery | animate() with Examples
- jQuery | prependTo() with Examples
- jQuery | undelegate() with Examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



