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.
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.
js
new FocusEvent(type) new FocusEvent(type, options)
The FocusEvent()
constructor also inherits arguments from UIEvent()
and from Event()
.
type
A string with the name of the event. It is case-sensitive and browsers set it to blur
, focus
, focusin
, or focusout
.
options
Optional
An object that, in addition of the properties defined in UIEvent()
, can have the following properties:
An EventTarget
representing the secondary target of a FocusEvent
. It defaults to null
.
Specification |
---|
UI Events # dom-focusevent-focusevent |
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
FocusEvent |
26 | 12 | 24 | No | 15 | 7 | 4.4 | 26 | 24 | 14 | 7 | 1.5 |
FocusEvent
interface it belongs to.
© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/FocusEvent/FocusEvent