mozilla
Your Search Results

    event.type Redirect 1

    Summary

    Returns a string containing the type of event.

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

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

    Syntax

    event.type
    

    Examples

    var string = event.type;
    
    <!DOCTYPE html>
    <html lang="en">
    <head>
    
    <title>type example</title>
    
    <script>
    var currEvent = null;
    
    function getEvtType(evt) {
      currEvent = evt.type;
      document.getElementById("Etype").firstChild.nodeValue = currEvent;
    }
    
    </script>
    </head>
    
    <body
      onkeydown="getEvtType(event)"
      onkeyup="getEvtType(event)"
      onmousedown="getEvtType(event)"
      onmouseup="getEvtType(event)">
    
    <p>Press any key or click the mouse to get the event type.</p>
    <p>Event type: <span id="Etype">-</span></p>
    
    </body>
    </html>
    

    Specification

    Document Tags and Contributors

    Contributors to this page: Sheppy
    Last updated by: Sheppy,