-4

In my project, I have a button with onclick event. for that event, I have some function but I want that function should execute after some time. if any way to execute the function after some delay?

if anyone knows please share the answer with me.

Sankar S
  • 59
  • 1
  • 8
  • Did you search your problem on Stackoverflow? It seems that this one https://stackoverflow.com/questions/17690193/delaying-click-event fits to your needs – duc mai Mar 26 '19 at 17:33

2 Answers2

0

For some time lag you can call your onclick function inside setTimeout, maybe that can help you.

function foo(){...}

setTimeout(foo, 2000);
smkskr
  • 11
  • 1
  • 3
-1

Have you tried using a setTimeout() method?

Artemis
  • 37
  • 5