Skip to content
Related Articles

Related Articles

Improve Article

HTML | DOM TouchEvent targetTouches Property

  • Last Updated : 31 Jan, 2019
Geek Week

The TouchEvent targetTouches property is a read-only property and used for returning an array of Touch objects. It returns one object for each finger that is touching the current target element.

Syntax :


Below program illustrates the TouchEvent targetTouches property :

Example: Finding out the number of fingers that touch an element.

<!DOCTYPE html>
<meta name="viewport" 
      content="width=device-width, initial-scale=1">
    <title> TouchEvent targetTouches property in HTML
        #samplediv {
            border: 1px solid green;
        h1 {
            color: green;
        h2 {
            font-family: Impact;
        body {
            text-align: center;
<body ontouchstart="countTouches(event)" 
    <h2> TouchEvent targetTouches property </h2>
    <p>The current element is touched by 
      <span id="touch">0</span> fingers.</p>
        function countTouches(event) {
            //  Returning touched target.
            var t = event.targetTouches.length;
            document.getElementById("touch").innerHTML =


After touching the screen:

After touching the screen:

Supported Browsers:

  • Opera
  • Internet Explorer
  • Google Chrome
  • Firefox
  • Apple Safari

Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.

My Personal Notes arrow_drop_up
Recommended Articles
Page :