Someone mentioned that document.write breaks your HTML. What should I then use? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Someone mentioned that document.write breaks your HTML. What should I then use?

29th May 2020, 11:51 AM
Samir_Shah
Samir_Shah - avatar
4 Answers
+ 4
You should never use document.write to make any webpages, use dom element access methods of document object instead, which are getElementById, getElementsByClassName, getElementsByTagName, getQuerySelector, getQuerySelectorAll.
29th May 2020, 12:08 PM
Calviղ
Calviղ - avatar
0
Can you give me an example?
29th May 2020, 11:57 AM
Samir_Shah
Samir_Shah - avatar
29th May 2020, 12:05 PM
Igor Kostrikin
Igor Kostrikin - avatar
0
Thanks 😁
29th May 2020, 12:30 PM
Samir_Shah
Samir_Shah - avatar