FocusEvent
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
TheFocusEvent interface represents focus-related events, includingfocus,blur,focusin, andfocusout.
In this article
Constructor
FocusEvent()Creates a
FocusEventevent with the given parameters.
Instance properties
This interface also inherits properties from its parentUIEvent, and indirectly fromEvent.
FocusEvent.relatedTargetAn
EventTargetrepresenting a secondary target for this event. In some cases (such as when tabbing in or out a page), this property may be set tonullfor security reasons.
Instance methods
This interface has no specific methods. It inherits methods from its parentUIEvent, and indirectly fromEvent.
Order of events
When focus is shifted from element A to element B, focus events are dispatched in the following order:
blur: sent after element A loses focus.focusout: sent after theblurevent.focus: sent after element B receives focus.focusin: sent after thefocusevent.
Specifications
| Specification |
|---|
| UI Events> # interface-focusevent> |
Browser compatibility
See also
- The
Eventbase interface