In My application I am facing some problem with setting delay when appending some html to a div within a array. (subsequent time). Please see the following code. 10 times I am appending " Hello World" text into a div. I want some delay after each append.
function someFunction(){
for(var i=0;i<10;i++)
{
addElement();
}
}
function addElement()
{
$('.SomeDiv').append('<div>Hello World</div>');
}
I have tried like this:
function someFunction(){
for(var i=0;i<10;i++)
{
setTimeOut(function(){
addElement();
},1000);
}
}
But this is not working. How can I do this.