Utility of node elements? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Utility of node elements?

Hello, I don't understand what is The utility of the document.createTextNode function? Can someone help me please?

23rd Jan 2018, 12:49 PM
ChuckLennon
ChuckLennon - avatar
4 Answers
+ 3
A text node is the way you can append text to an element. You can use the appendChild function to append a textNode to an HTMLElement.
24th Jan 2018, 11:57 AM
Lil Taco
Lil Taco - avatar
+ 4
You can also use element.innerHTMl which stores the inner HTML and can be edited with the = sign
24th Jan 2018, 1:46 PM
Lil Taco
Lil Taco - avatar
0
So If I want a new text when the user performs an action, I have to use this function alright? But is there another utility?
24th Jan 2018, 12:08 PM
ChuckLennon
ChuckLennon - avatar
0
Okay, I see now Thank you very much :)
24th Jan 2018, 6:31 PM
ChuckLennon
ChuckLennon - avatar