Your Search Results

    Template:KeyboardEventProperties

    <tr>
      <td><code>target</code></td>
      <td>EventTarget (DOM element)</td>
      <td>Focused element processing the key event, root element if no suitable input element focused.</td>
    </tr>
    <tr>
      <td><code>char</code> <%- template("readOnlyInline") %> <%- template("notimplemented_inline", ["680830"]) %></td>
      <td>DOMString (string)</td>
      <td>
        The character value of the key. 
        If the key corresponds to a printable character, this value is a non-empty Unicode string containing that character.
        If the key doesn't have a printable representation, this is an empty string.
        See <a href="/en-US/docs/Web/API/KeyboardEvent#Key_names_and_Char_values">key names and char values</a> for the detail.
        <div class="note">
          <strong>Note:</strong> If the key is used as a macro that inserts multiple characters, this attribute's value is the entire string, not just the first character.
        </div>
      </td>
    </tr>
    <tr>
      <td><code>key</code> <%- template("notimplemented_inline", ["680830"]) %></td>
      <td>DOMString (string)</td>
      <td>
        The key value of the key represented by the event.
        If the value has a printed representation, this attribute's value is the same as the <code>char</code> attribute.
        Otherwise, it's one of the key value strings specified in {{ anch("Key values") }}.
        If the key can't be identified, this is the string "Unidentified".
        See <a href="/en-US/docs/Web/API/KeyboardEvent#Key_names_and_Char_values">key names and char values</a> for the detail.
        Read Only.
      </td>
    </tr>
    <tr>
      <td><code>charCode</code> <%- template("readOnlyInline") %> <%- template("deprecated_inline") %></td>
      <td>Unsigned long (int)</td>
      <td>
        The Unicode reference number of the key; this attribute is used only by the <a href="/en-US/docs/Mozilla_event_reference/keypress"><code>keypress</code></a> event.
        For keys whose <code>char</code> attribute contains multiple characters, this is the Unicode value of the first character in that attribute.
        <div class="warning">
          <strong>Warning:</strong> This attribute is deprecated; you should use <code>char</code> instead, if available.
        </div>
      </td>
    </tr>
    <tr>
      <td><code>keyCode</code> <%- template("readOnlyInline") %> <%- template("deprecated_inline") %></td>
      <td>Unsigned long (int)</td>
      <td>
        A system and implementation dependent numerical code identifying the unmodified value of the pressed key.
        This is usually the decimal ASCII ({{ RFC(20) }}) or Windows 1252 code corresponding to the key; see {{ anch("Virtual key codes") }} for a list of common values.
        If the key can't be identified, this value is 0.
        <div class="warning">
          <strong>Warning:</strong> This attribute is deprecated; you should use <code>key</code> instead, if available.
        </div>
      </td>
    </tr>
    <tr>
      <td><code>which</code> <%- template("readOnlyInline") %> <%- template("deprecated_inline") %></td>
      <td>Unsigned long (int)</td>
      <td>
        A system and implementation dependent numeric code identifying the unmodified value of the pressed key; this is usually the same as <code>keyCode</code>.
        <div class="warning">
          <strong>Warning:</strong> This attribute is deprecated; you should use <code>key</code> instead, if available.
        </div>
      </td>
    </tr>
    <tr>
      <td><code>location</code> <%- template("readOnlyInline") %></td>
      <td>long (float)</td>
      <td>The location of the key on the device.</td>
    </tr>
    <tr>
      <td><code>repeat</code> <%- template("readOnlyInline") %> <%- template("notimplemented_inline") %></td>
      <td>boolean</td>
      <td><% if ( $0 ) { %>
        $0
      <% } else { %>
        <code>true</code> if a key has been depressed long enough to trigger key repetition, otherwise <code>false</code>.
      <% } %></td>
    </tr>
    <tr>
      <td><code>locale</code> <%- template("readOnlyInline") %> <%- template("notimplemented_inline") %></td>
      <td>string</td>
      <td>The language code for the key event, if available; otherwise, the empty string.</td>
    </tr>
    Search for pages that use Template:KeyboardEventProperties to see example use cases and how many pages use this macro.

    Document Tags and Contributors

    Contributors to this page: ethertank, openjck, louisremi
    Last updated by: ethertank,