TouchEvent ctrlKey Property

❮ DOM Events ❮ TouchEvent

Example

Find out whether or not the "CTRL" key was pressed when you touch the screen:

if (event.ctrlKey) {
  alert("The CTRL key was pressed!");
} else {
  alert("The CTRL key was NOT pressed!");
}
Try it Yourself »

Description

The ctrlKey property returns a Boolean value that indicates whether or not the "CTRL" key was pressed when a touch event was triggered.

Note: Many touch devices do not have an "CTRL" key, and will therefore always return false.

Note: This property is read-only.


Browser Support

Property
ctrlKey 22 yes 52 Not supported Not supported

Syntax

event.ctrlKey

Technical Details

Return Value: A Boolean, indicating whether the "CTRL" key was pressed when the touch event occurred.

Possible values:

  • true - The ctrl key was pressed
  • false - The ctrl key was not pressed

Related Pages

HTML DOM reference: MouseEvent ctrlKey Property

HTML DOM reference: TouchEvent altKey Property

HTML DOM reference: TouchEvent metaKey Property

HTML DOM reference: TouchEvent shiftKey Property


❮ DOM Events ❮ TouchEvent

Copyright 1999-2023 by Refsnes Data. All Rights Reserved.