How do I change the content of a div element. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How do I change the content of a div element.

I have a text in div element and want to add for instance letters to left and right sides using set timeout method ?

21st Jul 2017, 4:58 PM
Manik Tafralian
Manik Tafralian - avatar
1 Answer
+ 2
Create a function to get the current text (innerHTML) of the element, then add new strings to its left or right, then put the new text back to the element. Call the function in the setTimeout function. Sorry if I misunderstood your point.
21st Jul 2017, 7:30 PM
Ipang