You are here: Reference > JavaScript > client-side > event handling > properties > shiftLeft (event)

shiftLeft property (event)

Browser support:
Sets or retrieves a Boolean value that indicates whether the left SHIFT key was down at the time when the event occurred.
If it is not necessary to know which SHIFT key was pressed, use the cross-browser shiftKey property.
For ALT and CTRL keys, use the (altKey, altLeft) and (ctrlKey, ctrlLeft) properties.
Note that Internet Explorer from version 9 started to support different event objects similarly to Firefox, Opera, Google Chrome and Safari. The event object passed to an event handler and the event object referred to by the window.event property are different in Internet Explorer from version 9 (except if the event handler is registered with the attachEvent method). The shiftLeft property is only supported by the window.event object.


You can find the related objects in the Supported by objects section below.
The shiftLeft property is read-only, except if the event object is created with the createEventObject method when it is read/write.

Possible values:

Boolean that sets or retrieves the state of the left SHIFT key.
One of the following values:
Left SHIFT key is up.
Left SHIFT key is down.
Default: this property has no default value.

Example HTML code 1:

This example illustrates the use of the shiftLeft property:
    <script type="text/javascript">
        function GetShiftState (event) {
            if (event.shiftKey) {
                    // window.event and event differ in IE9 !!!
                if (window.event && 'shiftLeft' in window.event) {
                    if (window.event.shiftLeft) {
                        alert ("Left Shift key is down.");
                    else {
                        alert ("Right Shift key is down.");
                else {
                    alert ("Shift key is down.");
            else {
                alert ("Shift key is up.");
    Press and hold down the left or right SHIFT key before you click on the button.
    <br />
    <button onclick="GetShiftState (event);">Get Shift keys state!</button>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content