This is an experimental technology
Because this technology's specification has not stabilized, check the compatibility table for the proper prefixes to use in various browsers. Also note that the syntax and behavior of an experimental technology is subject to change in future versions of browsers as the spec changes.
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 DOMStringrepresenting the name of the event.
- focusEventInitOptional
- Is a FocusEventInitdictionary, having the following fields:- "relatedTarget", optional and defaulting to- null, is an- EventTargetrepresenting the secondary target of a- FocusEvent.
 The FocusEventInitdictionary also accepts fields from theUIEventInitandEventInitdictionaries.
Specifications
| Specification | Status | Comment | 
|---|---|---|
| Document Object Model (DOM) Level 3 Events Specification The definition of 'FocusEvent()' in that specification. | Working Draft | Initial definition | 
Browser compatibility
| Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari | 
|---|---|---|---|---|---|
| Basic support | (Yes) | 24.0 (24.0) | Not supported | (Yes) | (Yes) | 
| Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile | 
|---|---|---|---|---|---|
| Basic support | (Yes) | 24.0 (24.0) | Not supported | (Yes) | (Yes) | 
See also
- The FocusEventinterface it belongs to.