Delete a written text | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Delete a written text

i was trying to delete the text that i made using document.write("x"); but i have zero idea how

30th May 2018, 1:06 AM
Leandro Nicolás López Hegui
Leandro Nicolás López Hegui - avatar
1 Answer
+ 5
You can use innerHTML to access and change the HTML content of an element you made with document.write(). Ex: document.getElementById("example").innerHTML = ""; //or use getElementsByClassName However, you have to assign a (preferably unique) ID or class to what you write in document.write(), so you can access it again.
30th May 2018, 1:29 AM
Tamra
Tamra - avatar