FocusEvent relatedTarget property
Definition and usage
The relatedTarget property returns the element related to the element that triggers the focus/blur event.
- For onfocus and onfocusin event, the related element is the element that loses focus.
- For onblur and onfocusout Event, the related element is the element that gains focus.
This property is read-only.
Example
Get the related element of the element that triggers the onfocus event:
function getRelatedElement(event) { alert(event.relatedTarget.tagName); }
Syntax
event.relatedTarget
Technical details
Return value: | Reference to the related element, or null if there is no related element. |
---|---|
DOM version: | DOM Level 3 Events |
Browsertilstand
Tallene i tabellen angiver den første browserversion, der fuldt ud understøtter egenskaben.
Egenskaber | Chrome | IE | Firefox | Safari | Opera |
---|---|---|---|---|---|
relatedTarget | Support | 9.0 | 24.0 | Support | Support |