C
Csaba2000
What's the recommended way to add text with entities
(e.g. myText = "foo bar") to a newly created DIV?
I might create the DIV like so:
newDiv = document.createElement("DIV");
But the following does not work:
newText = document.createTextNode(myText);
newDiv.appendChild(newText);
The following does work, but is it the recommended way?:
newDiv.innerHTML = myText
Thanks,
Csaba Gabor from New York
(e.g. myText = "foo bar") to a newly created DIV?
I might create the DIV like so:
newDiv = document.createElement("DIV");
But the following does not work:
newText = document.createTextNode(myText);
newDiv.appendChild(newText);
The following does work, but is it the recommended way?:
newDiv.innerHTML = myText
Thanks,
Csaba Gabor from New York