<!DOCTYPE html>
<html lang="en-US">
<body>
<h2>Touch me</h2>
<script>
var x = document.getElementsByTagName("h2")[0];
function myFunction(){
alert("You touched me");
}
x.addEventListener("touchend", myFunction);
</script>
<p><strong>Note</strong>: This example is only for touch devices.</p> </body>
</html>