+ 1
How to use clearInterval?
2 Respuestas
+ 4
When you create your setinterval, make sure that you assign it to a variable so you can stop it later, especially if you have more than one running.
Example:
var helloInterval = setInterval(function(){ alert("Hello"); }, 3000);
To stop:
clearInterval(helloInterval);
Hope that helps.
+ 2
clearInterval() will basically stop the setInterval() function you give it from running.
More info here: https://www.w3schools.com/jsref/met_win_clearinterval.asp