MouseEvent relatedTarget property

Definition and Usage

The relatedTarget property returns the element related to the element that triggered the mouse event.

The relatedTargert property can:

  • Use it with the mouseover event to indicate the element that the cursor just exited
  • Or use it with the mouseout event to indicate the element that the cursor just entered

Note:This property is read-only.

Example

Get the element that the cursor just exited:

<p onmouseover="getRelatedElement(event)">Mouse over this paragraph.</p>
<script>
function getRelatedElement(event) { 
  uyarı("KurSOR just exited the " + event.relatedTarget.tagName + " element.");
}
</script>

Kişisel olarak deneyin

Gramer

event.relatedTarget

Teknik ayrıntılar

Dönüş değeri: İlgili öğelere atıf.
DOM sürümü: DOM Level 2 Olayları

Tarayıcı desteği

Özellikler Chrome IE Firefox Safari Opera
relatedTarget Destek Destek Destek Destek Destek