0
How to stop a setInterval() function?
I used one calling setInterval(timer,1000) but when i try to stop it, the clearInterval() don't work
5 Antworten
+ 4
Example:
var st = setInterval(timer,1000)
clearInterval(st)
It will work.
+ 3
Yes, when you clear the interval, you have to tell inside () what interval you are clearing.
+ 1
So... I have to assign the interval into a variable, not just declare the set and after the clear?
+ 1
Okay, thanks