1 votes

Why does innerHTML only work at the end of my loop?

See, I have this for loop:

 for(var i=0;i<=3;i++) {
    mida=parseInt(prompt("Escribe la mida"));
    altura=parseInt(prompt("Escriba la altura"));

    div.innerHTML=div.innerHTML+"Base: "+mida+"<br>Altura: "+altura+" 
    <br>Superficie: "+mida*(altura/1.5);

"Div" is a div that I have in HTML, the problem is that the div is only shown on my page when the loop ends, not when a pass ends, can someone help me?


HolaDevs is an online community of programmers and software lovers.
You can check other people responses or create a new question if you don't find a solution

Powered by: