- 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 event.relatedTarget Property
The event.relatedTarget property in jQuery is used to return which element being entered or exited on mouse movement.
Syntax
The syntax is as follows −
event.relatedTarget
Example
Let us now see an example to implement the jQuery event.relatedTarget property −
<!DOCTYPE html> <html> <head> <style> .demo { border:2px solid yellow; } </style> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("div, p").mouseenter(function(event){ $("#demo").html("Related target = " + event.relatedTarget.nodeName); }); }); </script> </head> <body> <h2>Demo Heading</h2> <div class="demo">This is a demo text. <p style="color: red">This is a demo line.</p> </div><br> <div id="demo" /> </body> </html>
Output
This will produce the following output −
Now, place the mouse cursor inside the div (box) −
Advertisements