I'm creating a progam, where JavaScript is processing a huge amount of data, so I want to show the progress on a progressbar.
The problem comes here: While the for loop is running, the progressbar does not update, and then it will be fullfilled immediately.
document.getElementById("start").addEventListener("click",function(){
max=1000000
document.getElementById("pb").max=max
for(i=0;i<max;i++){
document.getElementById("pb").value=i+1
}
console.log("Finished")
})
<progress id="pb" value="0" max="0"></progress>
<input type="button" id="start" value="Start"/>
How can I solve that problem?
I don't want to use any JS library, if it's possible without them.
Thanks for any help!