set interval time in for loop
by mariganesh[ Edit ] 2013-01-25 16:45:42
set interval time in for loop
Here is the for loop has to be changed to setinterval function.
For loop
for(var counter=0;counter<=10;counter++)
{
// do your thing
}
setinterval function
var counter = 0;
var i = setInterval(function(){
if(counter <= 10) {
// do your thing
counter++;
}
else
clearInterval(i);
}, 200);