How do I clear all the contents on a page using javascript? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How do I clear all the contents on a page using javascript?

I was wondering how (if possible) you can clear a document completely using javascript. Any ideas?

15th Apr 2017, 1:38 AM
iBrandon
iBrandon - avatar
1 Answer
+ 3
You mean like this document.getElementsByTagName('body')[0].innerHTML = '';
15th Apr 2017, 3:58 AM
Ashwani Kumar
Ashwani Kumar - avatar