FocusEvent()

The FocusEvent() constructor returns a newly created FocusEvent object with an optional EventTarget. When the event has both a source and a destination, the relatedTarget value must be set to the other target.

Syntax

var focusEvent = new FocusEvent(typeArg[, focusEventInit]);

Properties

The FocusEvent() constructor also inherits arguments from UIEvent() and from Event().

typeArg
Is a DOMString representing the name of the event.
focusEventInit Optional
Is a FocusEventInit dictionary, having the following fields:
  • "relatedTarget", optional and defaulting to null, is an EventTarget representing the secondary target of a FocusEvent.

The FocusEventInit dictionary also accepts fields from the UIEventInit and EventInit dictionaries.

Specifications

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

Browser compatibility

DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
FocusEvent() constructor
Experimental
Chrome Full support YesEdge Full support ≤18Firefox Full support 24IE No support NoOpera Full support YesSafari Full support YesWebView Android Full support YesChrome Android Full support YesFirefox Android Full support 24Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes

Legend

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

See also