The Event.type read-only property returns a string containing the event's type. It is set when the event is constructed and is the name commonly used to refer to the specific event, such as click, load, or error

The event argument of EventTarget.addEventListener() and EventTarget.removeEventListener() is case insensitive.

For a list of available event types, see the event reference




<!DOCTYPE html>
<html lang="en">
    <meta charset="utf-8">

    <title>Event.type Example</title>

        var currEvent;
        function getEvtType(evt) {

            currEvent = evt.type;

            document.getElementById("Etype").innerHTML = currEvent;


        //Keyboard events
        document.addEventListener("keypress", getEvtType, false); //[second]  

        document.addEventListener("keydown", getEvtType, false); //first
        document.addEventListener("keyup", getEvtType, false); //third

        //Mouse events
        document.addEventListener("click", getEvtType, false); // third

        document.addEventListener("mousedown", getEvtType, false); //first
        document.addEventListener("mouseup", getEvtType, false); //second



<p>Press any key or click the mouse to get the event type.</p>
<p>Event type: <span id="Etype" style="color:red">-</span></p>




Specification Status Comment
The definition of 'Event.type' in that specification.
Living Standard  
Document Object Model (DOM) Level 2 Events Specification
The definition of 'Event.type' in that specification.
Obsolete Initial definition.

 Browser compatibility

Update compatibility data on GitHub
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidiOS SafariSamsung Internet
Basic supportChrome Full support 45Edge ? Firefox ? IE ? Opera Full support 32Safari ? WebView Android Full support 45Chrome Android Full support 45Edge Mobile ? Firefox Android ? Opera Android Full support 32Safari iOS ? Samsung Internet Android ?


Full support  
Full support
Compatibility unknown  
Compatibility unknown