UIEvent
UI Events
UI Events
The **`UIEvent`** interface represents simple user interface events. It is part of the [UI Events](/docs/Web/API/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.
## Constructors
- UIEvent()
- : Creates a `UIEvent` object.
## Instance properties
_This interface also inherits properties of its parent, Event._
- UIEvent.detail
- : Returns a `long` with details about the event, depending on the event type.
- UIEvent.sourceCapabilities
- : Returns an instance of the `InputDeviceCapabilities` interface, which provides information about the physical device responsible for generating a touch event.
- UIEvent.view
- : Returns a WindowProxy that contains the view that generated the event.
- UIEvent.which
- : 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()
- : Initializes a `UIEvent` object. If the event has already been dispatched, this method does nothing.
## Specifications
## Browser compatibility
## See also
- [UI Events API](/docs/Web/API/UI_Events)
- [Introduction to events](/docs/Learn_web_development/Core/Scripting/Events)
- Event
Cite this
"UIEvent". MDN Web Docs. CC BY-SA 2.5 (MDN). https://developer.mozilla.org/en-US/docs/Web/API/UIEvent JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy