TouchEvent targetTouches Property

Example

Find out how many fingers that touches an element:

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

Description

The targetTouches property returns an array of Touch objects, one for each finger that is touching the current target element.

Note: This property is read-only.


Syntax

event.targetTouches

Technical Details

Return Value: An Array of Touch objects.

Related Pages

HTML DOM reference: TouchEvent touches Property


More Examples

Example

Return 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 »

Browser Support

event.targetTouches is a DOM Level 3 (2004) feature.

It is fully supported in all modern browsers:

Chrome Edge Firefox Safari Opera IE
Yes Yes Yes Yes Yes 11


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