I have a long running Javascript function, that looks like this:
window.myFunction = function() {
for(var i=0;i<500;i++){
// calling a function here
document.getElementbyID('mySpan').innerHTML = "Completed step " + i + "/500"
}
}
My function calls another synchronous function very often (I used 500 in this example) and while the user waits for the task to complete, i'd like to implement something like a loading bar but I demonstrated it with updating a span in my case here. Is it possible to force a DOM refresh of some sort every time I update my span?
getElementById