Execute function every nth second
- by timkl
Total JacaScript n00b question right here:
I've made this snippet that clicks a link after 10th second:
function timeout() {
window.setTimeout(function() {
$('img.left').click();
}, 1000);
setTimeout("timeout()", 1000);
}
timeout();
My question is, how do I execute this function every 10th second, instead of just once?
Is this the best way to do this, or is there some kind of nifty jQuery method that you prefer?