Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
93
rated 0 times [  98] [ 5]  / answers: 1 / hits: 197618  / 15 Years ago, fri, february 19, 2010, 12:00:00

Is there anyway to implement a timer for JQuery, eg. every 10 seconds it needs to call a js function.



I tried the following



window.setTimeout(function() {
alert('test');
}, 10000);


but this only executes once and then never again.


More From » jquery

 Answers
13

You can use this:



window.setInterval(yourfunction, 10000);

function yourfunction() { alert('test'); }

[#97538] Monday, February 15, 2010, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
maxh

Total Points: 137
Total Questions: 100
Total Answers: 103

Location: Kazakhstan
Member since Mon, Sep 26, 2022
2 Years ago
;