views:

1693

answers:

1

I have a few places where I use the line below to clear out a status for example. I have a few of these that hang out for 10 seconds or more and if the user gets clicking around the action can occur at incorrect time intervals. Is it possible to cancel or kill this w/ some jQuery or JavaScript so I don't have this process hanging around?

window.setTimeout(function() { removeStatusIndicator(); }, statusTimeout);
+11  A: 
var timer1 = window.setTimeout(function() { removeStatusIndicator(); }, statusTimeout);
clearTimeout(timer1)
Diodeus
Actually it's window.clearTimeout(…)
Georg
window is just the name of the global namespace, so it's not really necessary (for either setTimeout or clearTimeout).
Matthew Crumley