THE WORLD'S LARGEST WEB DEVELOPER SITE

TouchEvent touches Property

❮ DOM Events ❮ TouchEvent

Example

Find out how many fingers that touches the surface:

function countTouches(event) {
  var x = event.touches.length;
}
Try it Yourself »

Definition and Usage

The touches property returns an array of Touch objects, one for each finger that is currently touching the surface.

Note: This property is read-only.


Browser Support

Property
touches 22 yes 52 Not supported Not supported

Syntax

event.touches

Technical Details

Return Value: An Array of Touch objects.

Related Pages

HTML DOM reference: TouchEvent targetTouches Property


More Examples

Example

Return the x- and y-coordinates of the touch:

function showCoordinates(event) {
  var x = event.touches[0].clientX;
  var y = event.touches[0].clientY;
}
Try it Yourself »

❮ DOM Events ❮ TouchEvent