DOM Event.type Property
The type property of an event gives its name, such as click, input or keydown.
Description
The read-only type property contains the name of the event, the same string used with addEventListener(). It's useful when one function handles several kinds of event.
Event names are lower case for built-in events, apart from a few historical exceptions such as DOMContentLoaded. Custom events can use any string, so a consistent naming scheme helps keep them recognizable.
Checking event.type lets one handler serve related events, such as treating mouseenter and focus the same way to show a tooltip, and mouseleave and blur to hide it, which keeps behaviour consistent for mouse and keyboard users.
Syntax
event.typeValue
A string with the name of the event, such as "click".
Example
Browser Support
The following information will show you the current browser support for the Event.type property. Hover over a browser icon to see the version that first introduced support for this property.
Desktop





Tablets & Mobile





