I am using setInterval(fname, 10000); to call a function every 10 seconds in JavaScript. Is it possible to stop calling it on some event?
setInterval(fname, 10000);
I want the us
If you set the return value of setInterval to a variable, you can use clearInterval to stop it.
setInterval
clearInterval
var myTimer = setInterval(...); clearInterval(myTimer);