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.
UIEvent()Creates a UIEvent object.
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.
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.
| Specification |
|---|
| UI Events> # idl-uievent> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
UIEvent |
26 | 12 | 11 | 15 | 7 | 26 | 14 | 14 | 7 | 1.0 | 4.4 | 7 |
UIEvent |
1 | 12 | 1 | ≤12.1 | 1 | 18 | 4 | ≤12.1 | 1 | 1.0 | 4.4 | 1 |
detail |
1 | 12 | 1 | ≤12.1 | 1 | 18 | 4 | ≤12.1 | 1 | 1.0 | 4.4 | 1 |
initUIEvent |
1 | 12 | 1 | ≤12.1 | 1 | 18 | 4 | ≤12.1 | 1 | 1.0 | 4.4 | 1 |
sourceCapabilities |
47 | 79 | No | 34 | No | 47 | No | 34 | No | 5.0 | 47 | No |
view |
1 | 12 | 1 | ≤12.1 | 1 | 18 | 4 | ≤12.1 | 1 | 1.0 | 4.4 | 1 |
which |
1 | 79 | 1Onmousemove events, the which property is incorrectly always set to 1. |
15 | 1 | 18 | 4Onmousemove events, the which property is incorrectly always set to 1. |
14 | 1 | 1.0 | 4.4 | 1 |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/UIEvent