+ 2

Why do we use js document.write() when we can also write in body tag

17th May 2019, 2:50 PM
Chaitali
2 Answers
+ 3
To put anything in our website it's like put things in <body> tag
17th May 2019, 3:09 PM
Basel.Al_hajeri?.MBH()
Basel.Al_hajeri?.MBH() - avatar
+ 1
Yes, do not use document.write for any dom update. Beginners often misguide from the basic tutorials they learnt, where teach them to use document.write to update dom. In the actual web development scenarios, we do not use document.write at all. Start to learn the more practical document class update functions such as getElementById, getElementsByClassName, getElementsByTagName, querySelector and querySelectorAll.
17th May 2019, 2:58 PM
CalviŐČ
CalviŐČ - avatar