You don’t need an onload
event. Just setInterval()
with a function which will set a new value in a div:
function autoRefreshDiv() {
document.getElementById("people").innerHTML = Math.random();
}
setInterval(autoRefreshDiv, 1000); // Time is set in milliseconds
<div id="people"></div>
setInterval
will run the function every X milliseconds.
0
solved Div with random values that change with time