Javascript DOM touchcancel Event via HTML Tag touchcancel function

Introduction

In JavaScript:

object.ontouchcancel =
       myScript;

This example is for touch devices only.

View in separate window

<!DOCTYPE html>
<html>
<body>
<p id="myP">
Touch this paragraph while you do something that will interrupt the event. 
</p>//from ww w .j  a v a 2 s.  c  om
<p id="demo"></p>

<script>
document.getElementById("myP").ontouchcancel = myFunction;

function myFunction() {
  document.getElementById("demo").innerHTML = "Touch Cancelled";
}
</script>

</body>
</html>
Bubbles: Yes
Cancelable: Yes
Event type: TouchEvent
Supported HTML tags: All HTML elements



PreviousNext

Related