How can I clear or refresh the page in the browser using javascript? I have a loop that prints a string to the page each second and I want to clear the screen each time it updates.
If you append your string to the document body, you can just use
document.body.innerHTML = "";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With