+ 1
What code can i use to delay an event in javascript?
I have been working on a project for about 5 days, and wanted to make a button which would give a delay of 2 seconds before triggering the event. I need help, please :(
2 Antworten
+ 3
document.querySelector('button').addEventListener("click",() => setTimeout(yourFunctionName, 2000))
+ 2
Teddy Alejandro Moreira Vélez Hey check this code :)) The alert will be shown after 2 seconds.
https://code.sololearn.com/W6GAyRo9TzqO/?ref=app