MouseEvent shiftKey property

Definition and usage

The shiftKey property returns a boolean value indicating whether the "SHIFT" key was pressed during the mouse event.

Note:This property is read-only.

Example

Determine if the "SHIFT" key was pressed when clicking the mouse button:

if (event.shiftKey) {
  alert("The SHIFT key was pressed!");
}
  alert("The SHIFT key was NOT pressed!");
}

Try it yourself

Syntax

event.shiftKey

Technical details

Return value:

A boolean value indicating whether the "SHIFT" key was pressed during a mouse event.

Possible values:

  • true - Shift key pressed
  • false - Shift key not pressed
DOM version: DOM επίπεδο 2 γεγονότα

Υποστήριξη περιηγητή

Ενδεικτικά Chrome IE Firefox Safari Opera
shiftKey Υποστήριξη Υποστήριξη Υποστήριξη Υποστήριξη Υποστήριξη

Σχετικές σελίδες

HTML DOM εγχειρίδιο:ΕίσοδοςMouseEvent altKey ιδιότητα

HTML DOM εγχειρίδιο:ΕίσοδοςMouseEvent ctrlKey ιδιότητα

HTML DOM εγχειρίδιο:ΕίσοδοςMouseEvent metaKey ιδιότητα