UIEvent

The UIEvent interface represents simple user interface events. It is part of the UI Events API, which includes various event types and interfaces related to user interactions.

UIEvent derives from Event. Although the UIEvent.initUIEvent() method is kept for backward compatibility, you should create a UIEvent object using the UIEvent() constructor.

Several interfaces are direct or indirect descendants of this one: MouseEvent, TouchEvent, FocusEvent, KeyboardEvent, WheelEvent, InputEvent, and CompositionEvent.

Event UIEvent

Constructors

UIEvent()

Creates a UIEvent object.

Instance properties

This interface also inherits properties of its parent, Event.

UIEvent.detail Read only

Returns a long with details about the event, depending on the event type.

UIEvent.sourceCapabilities Experimental Read only

Returns an instance of the InputDeviceCapabilities interface, which provides information about the physical device responsible for generating a touch event.

UIEvent.view Read only

Returns a WindowProxy that contains the view that generated the event.

UIEvent.which Deprecated Read only

Returns the numeric keyCode of the key pressed, or the character code (charCode) for an alphanumeric key pressed.

Instance methods

This interface also inherits methods of its parent, Event.

UIEvent.initUIEvent() Deprecated

Initializes a UIEvent object. If the event has already been dispatched, this method does nothing.

Specifications

Specification
UI Events
# idl-uievent

Browser compatibility

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
UIEvent
UIEvent() constructor
detail
initUIEvent
Deprecated
sourceCapabilities
Experimental
view
which
Deprecated

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
Partial support
Partial support
No support
No support
Experimental. Expect behavior to change in the future.
Deprecated. Not for use in new websites.
See implementation notes.
Has more compatibility info.

See also