Execute a JavaScript when a touch is interrupted.
Touch events works for touch devices only.
<!DOCTYPE html> <html> <body> <p ontouchcancel="myFunction()"> Touch this paragraph while you do something that will interrupt the event. </p>//from w ww .ja v a2s .c o m <p id="demo"></p> <script> function myFunction() { document.getElementById("demo").innerHTML = "Touch Cancelled"; } </script> </body> </html>
The touchcancel event occurs when the touch event gets interrupted.
The touchstart event will only work on devices with a touch screen.
Bubbles: | Yes |
---|---|
Cancelable: | Yes |
Event type: | TouchEvent |
Supported HTML tags: | All HTML elements |