본문 바로가기

Javascript

[Javascript] touchstart / touchend

반응형

touchstart

document.getElementById("myP").addEventListener("touchstart", myFunction);

function myFunction() {
  document.getElementById("demo").innerHTML = "Hello World";
}
document.getElementById("myP").ontouchend = myFunction;

function myFunction() {
  document.getElementById("demo").innerHTML = "Hello World";
}

 

touchend

document.getElementById("myP").addEventListener("touchend", myFunction);

function myFunction() {
  document.getElementById("demo").innerHTML = "Hello World";
}
document.getElementById("myP").ontouchend = myFunction;

function myFunction() {
  document.getElementById("demo").innerHTML = "Hello World";
}

 

 

 

반응형

'Javascript' 카테고리의 다른 글

[Javascript] for in / for of  (0) 2021.05.06
[Javascript] setTimeout  (0) 2021.03.16
[Javascript] for in  (0) 2021.03.03
[Javascript] window.history.back(), history.forward(), history.go()  (0) 2021.02.26
[Javascript] 즉시 실행 함수  (0) 2021.02.25