jQuery | mouseover() with Examples
The mouseover() method is an inbuilt method in jQuery which works when mouse pointer moves over the selected elements.
Syntax:
$(selector).mouseover(function)
Parameters: This method accepts single parameter function which is optional. This parameter is used to specify the function to run when the mouseover event is called.
Return Value: This method returns the selected element with the change.
Below example illustrates the mouseover() method in jQuery:
Example:
<!DOCTYPE html><html> <head> <title>The mouseover Method</title> <script src= </script> <!-- jQuery code to show the working of this method --> <script> $(document).ready(function() { $("p").mouseover(function() { $("p").css("background-color", "lightgreen"); }); }); </script> <style> body { width: 280px; padding: 40px; height: 30px; border: 2px solid green; font-weight: bold; font-size: 20px; } </style> </head> <body> <!-- move over this text to see the change --> <p>Welcome to GeeksforGeeks!</p> </body></html> |
Output:
Before mouse move over the paragraph:
After moving mouse over the paragraph:
Related Articles:


