Js ontouchstart problem | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Js ontouchstart problem

Hi I have decided to make a game but ran into a problem when ontouchstart is held to long the copy and paste menu pops up and brakes the game is there away to stop this possibly disable copy and paste?🤔 Thanks

24th Oct 2019, 6:50 AM
D_Stark
D_Stark - avatar
2 Answers
+ 2
Maybe try el.addEventListener("contextmenu", e => { e.preventDefault(); }); I'm not sure if that will solve it, but that'd be my first guess. Either way you'll have to `preventDefault` some event.
24th Oct 2019, 8:37 AM
Schindlabua
Schindlabua - avatar
+ 2
Schindlabua thanks I'll give it a try
24th Oct 2019, 8:43 AM
D_Stark
D_Stark - avatar