Reputation: 736
I have an action that happens every 1 second:
(function(){
$('.testme').jClever();
setTimeout(arguments.callee, 1000);
})()
How can I stop it once it happened?
UPDATED: .testme comes from xmlhttpPost action and I can't get it work other way.
Upvotes: 0
Views: 126
Reputation: 21834
You have to use clearTimeout() to stop setTimeout(), eg:
var clr = null;
(function(){
$('.testme').jClever();
clr = setTimeout(arguments.callee, 1000);
})()
// assuming that arguments.callee is a function named foo
function foo() {
clearTimeout(clr);
}
Upvotes: 1