How do I make Document w not replace a website code?

Asked

Viewed 31 times

-1

whenever I use Document.write, everything the site code is replaced, has how to do this without the code being replaced?

the site does not let me publish the question without an image

inserir a descrição da imagem aqui

  • could you explain better what you’re doing? How can I reproduce the error?

  • i created a click event for when I clicked on an obj would create a <p>, but when using Document.write to create it, the code on the site is uploaded only by <p>

1 answer

0

Set the id in the tag you want to insert this paragraph with for example "content". And set the content as follows:

document.getElementById("content").innerHTML = "<p>New text!</p>";

Browser other questions tagged

You are not signed in. Login or sign up in order to post.