I am working on a website, where I need to create a pause or delay.
So please tell me How to create pause or delay in for
loop in javascript
or jQuery
This is a test example
var s = document.getElementById("div1");
for (i = 0; i < 10; i++) {
s.innerHTML = s.innerHTML + i.toString();
//create a pause of 2 seconds.
}
setTimeout()
andsetInterval()
APIs available in all browsers. – Fiesta