Everywhere I've searched I've only found ways to append a textnode after creating a new element. For example, they'll create a new paragraph (p
) element, and afterwards they append the textnode to that new paragraph. But I want to add a textnode to an existing element (in my case, an empty span).
Link to code for example and clarification http://pastebin.com/K1EBMr4Z
<span class="span"></span> <!-- append textnode here -->
function newFunction(){
var textnode = document.createTextNode("OK");
// Append my `textnode` to the empty span here
}
Thanks in advance