TouchEvent targetTouches Property

Definition and Usage

The targetTouches property returns an array of Touch objects, with each object corresponding to a finger touching the current target element.

targetTouches is a read-only TouchList object that contains all the Touch objects that are still in contact with the touch surface.

Note:This property is read-only.

Instance

Example 1

Determine the number of fingers touching the element:

function countTouches(event) {
  var x = event.targetTouches.length;
}

Try it yourself

Example 2

Returns the tag name of the current element:

function getTagname(event) {
  var x = event.touches[0].clientX;
  var y = event.touches[0].clientY;
}

Try it yourself

Syntax

event.targetTouches

Technical Details

Return Value: Array of Touch Objects.

Browser Support

The numbers in the table indicate the first browser version that fully supports the property.

Properties Chrome IE Firefox Safari Opera
targetTouches 22 Supported 52 Not Supported Not Supported

Related Pages

HTML DOM Reference Manual:TouchEvent touches Property