Get named function to repeat itself continuously in jQuery
jquery
Solution
If you want to call a function on a regular interval you should use `setInterval()`.
var myFunction = function() {};
setInterval(myFunction, 1000); // call every 1000 milliseconds
If you ever need to stop the function from being called forever, setInterval() returns an id that you can use to stop the timer as well. Here's an example.
var myFunction = function() {};
var timer = setInterval(myFunction, 1000);
clearTimeout(timer);
Problem
I'm trying to get a function to repeat itself once it starts, but I must be off today because I can't figure it out. Here's my code: ``` function runNext() { galleryNext().delay(1500).runNext(); } ``` Thanks in advance.