How to make an onclick function delay before execution | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How to make an onclick function delay before execution

29th Dec 2020, 11:55 AM
Villain
Villain - avatar
2 Answers
+ 4
Mirielle[ Inactive ] I was precisely looking into this, thank you. I have written a memory game but the time control with SetTimeout is a mess. It mostly works (and it does in other codes) but handling touch events and calling methods, behaviour is sometimes unpredictable. I wonder if sticking to time system is the only way to ensure control.
29th Dec 2020, 6:47 PM
bell
bell - avatar
+ 1
Dexter 🐺 you can you the setTimeout function to delay function execution. Refer this link for details https://www.w3schools.com/jsref/met_win_settimeout.asp
29th Dec 2020, 11:59 AM
Art1mis