How to clear content on a page | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to clear content on a page

How do you clear content on a page

10th Nov 2016, 12:17 AM
koder
koder  - avatar
2 Answers
+ 4
You mean delete or hide all element of html you can use var a = document. getElementsByTagName("body"); a.innerHTML=0; or you can use jQuery. It will more better var a = $("body"); a.hide(); but you have to add a line in head element <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"> </script> correct me If I understand your question in wrong way.
10th Nov 2016, 1:51 AM
Aditya kumar pandey
Aditya kumar pandey - avatar
+ 4
simply do document.write( " "); it is used for writing anything. if you erase and rewrite then that's it. use the things inside it to the things you want to be writtenon the screen
10th Nov 2016, 8:48 AM
Sandeep Chatterjee