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!");
} else {
  alert("The SHIFT key was NOT pressed!");
}

Try it yourself

Syntax

event.shiftKey

Technical details

Return value:

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: Matukio ya DOM Level 2

Matumizi ya kivunja

Mabaki Chrome IE Firefox Safari Opera
shiftKey Msaada Msaada Msaada Msaada Msaada

Vipindi vya pengine

Makao ya HTML DOM:Mwili wa MouseEvent altKey

Makao ya HTML DOM:Mwili wa MouseEvent ctrlKey

Makao ya HTML DOM:Mwili wa MouseEvent metaKey