TouchEvent: targetTouches property

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

The targetTouches read-only property is a TouchList listing all the Touch objects for touch points that are still in contact with the touch surface and whose touchstart event occurred inside the same target element as the current target element.

Value

A TouchList listing all the Touch objects for touch points that are still in contact with the touch surface and whose touchstart event occurred inside the same target element as the current target element.

Examples

This example illustrates the TouchEvent object's TouchEvent.targetTouches property. The TouchEvent.targetTouches property is a TouchList object that includes those TPs that are currently touching the surface and started on the element that is the target of the current event. As such, the targetTouches list is a strict subset of the touches list.

In following code snippet, the function compares the length of the touches list to the length of the targetTouches list and returns true if the lengths are the same and returns false otherwise.

js
function touches_in_target(ev) {
  // Return true if all of the touches are within the target element;
  // otherwise return false.
  return ev.touches.length === ev.targetTouches.length;
}

Specifications

Specification
Touch Events
# dom-touchevent-targettouches

Browser compatibility

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
targetTouches

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
Has more compatibility info.