- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
jQuery mouseover() with Examples
The mouseover() method in jQuery is used to trigger the mouseover event. It occurs when the mouse pointer is over the selected element.
Syntax
The syntax is as follows −
$(selector).mouseover(func)
Example
Let us now see an example to implement the jQuery mouseover() method −
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("h1").mouseover(function(){ $("h1").css("color", "green"); }); $("h1").mouseout(function(){ $("h1").css("color", "orange"); }); }); </script> </head> <body> <h1>Demo Heading1</h1> </body> </html>
Output
This will produce the following output −
Now, when the mouse pointer is over the selected element −
Now, when the mouse pointer leaves the selected element, the text color changes again −
Advertisements