FocusEvent.relatedTarget

The FocusEvent.relatedTarget read-only property is the secondary target, depending on the type of event:

Event name target relatedTarget
blur The EventTarget losing focus The EventTarget receiving focus (if any).
focus The EventTarget receiving focus The EventTarget losing focus (if any)
focusin The EventTarget receiving focus The EventTarget losing focus (if any)
focusout The EventTarget losing focus The EventTarget receiving focus (if any)

Note that many elements can't have focus, which is a common reason for relatedTarget to be null. relatedTarget may also be set to null for security reasons, like when tabbing in or out of a page.

MouseEvent.relatedTarget is a similar property for mouse events.

Syntax

secondTarget = focusEvent.relatedTarget

Specifications

Specification Status Comment
UI Events
The definition of 'FocusEvent.relatedTarget' in that specification.
Working Draft
Document Object Model (DOM) Level 3 Events Specification
The definition of 'FocusEvent.relatedTarget' in that specification.
Obsolete Initial definition.

Browser compatibility

DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
relatedTarget
Experimental
Chrome Full support YesEdge Full support 12Firefox Full support 48IE Full support 9Opera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesFirefox Android Full support 48Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes

Legend

Full support
Full support
Experimental. Expect behavior to change in the future.
Experimental. Expect behavior to change in the future.

See also