Question

I am currently teaching myself the HTML DOM, and I have learned that (in order to create an HTML element) I must use document.create & document.createTextNode. My question is whether all HTML elements require a text node? Do image tags, form fields, or other HTML elements which don't display text have a textnode value?

Was it helpful?

Solution

No. Text nodes are only required if you want text (other then that supplied through a property such as HTMLInputElement.value) in an element.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top