Home >>jQuery Tutorial >jQuery event.relatedTarget Property

jQuery event.relatedTarget Property

jQuery event.relatedTarget Property

The event.relatedTarget property in jQuery is used to returns the element that is being exited or entered on mouse movement


Parameter Values

Parameter Description
event It is a required parameter and is used to specify the event parameter comes from the event binding function
Here is an Example of jQuery event.relatedTarget Property:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
$(".box, .txt").mouseenter(function(event){
$("#output").html("Related target is: " + event.relatedTarget.nodeName);
<div class="box" style="height:180px;border:solid">This is a div element 
  <p class="txt" style="background-color:orange">This is a paragraph</p>
<div id="output" />

This is a div element

This is a paragraph