Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I clear the screen with javascript?

Tags:

javascript

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.

like image 883
iKlsR Avatar asked Oct 20 '25 11:10

iKlsR


1 Answers

If you append your string to the document body, you can just use

document.body.innerHTML = "";

Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!