+ 2
Why do we use js document.write() when we can also write in body tag
2 Antworten
+ 3
To put anything in our website it's like put things in <body> tag
+ 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.