Execute a JavaScript when the user releases the touch:
This example is for touch devices only.
<!DOCTYPE html> <html> <body> <p ontouchend="myFunction()"> Touch this paragraph, then release the touch to trigger a function that will write "Hello World".</p> <p id="demo"></p> <script> function myFunction() {/*from w w w. ja v a2 s.c om*/ document.getElementById("demo").innerHTML = "Hello World"; } </script> </body> </html>
The touchend event occurs when the user removes the finger from an element.
The touchend event will only work on devices with a touch screen.
Bubbles: | Yes |
---|---|
Cancelable: | Yes |
Event type: | TouchEvent |
Supported HTML tags: | All HTML elements |