W3cubDocs

/DOM

FocusEvent.constructor

This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

The FocusEvent() constructor returns a newly created FocusEvent object with an optional EventTarget. When a change a focus has 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.
focusEventInitOptional
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

Browser compatibilityUpdate compatibility data on GitHub

Desktop
Chrome Edge Firefox Internet Explorer Opera Safari
Basic support Yes Yes 24 No Yes Yes
Mobile
Android webview Chrome for Android Edge Mobile Firefox for Android Opera for Android iOS Safari Samsung Internet
Basic support Yes Yes Yes 24 Yes Yes ?

See also

© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/FocusEvent/FocusEvent