Toran Billups Toran Billups - 1 year ago 128
Javascript Question

How to cancel/kill window.setTimeout before it happens on the client?

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);

Answer Source
var timer1 = setTimeout(function() { removeStatusIndicator(); }, statusTimeout);

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download