Here’s what I have:
I create this markup on the fly:
<p id="amount"><span></span></p>
Now I need to fill up the span:
if (amount.firstChild.nodeType == 1) {
amount.firstChild.nodeValue = text;
alert(description.firstChild.nodeType); //this shows SPAN
}
amount is a variable created with getElementbyId and text is a variable that it works and shows just a figure.
Now, why isn’t accepting text as a value? It renders and empty span… and text is working just fine….
thanks a lot fellas!
You can test for a nested text node in the span, and if there isn’t one, create it.