Working with the Text Node and Changing Content

For Text Node there is also no traveling inside a text node, because it can't have any children.

With the JavaScript method innerHTML, we can change or modify the content.

<body>
    <div id="target-area">
        <p>This is our text.</p>
    </div>
</body>

In this example, we target the text node and change it to "hello world".

// targeting the text node
document.getElementById("target-area"). innerHTML ;

// changing the content in the text node - you can jump straight to this.
document.getElementById("target-area"). innerHTML = "<p>hello world</p>";
Related Tutorial
Follow Us
https://www.facebook.com/Rookie-Nerd-638990322793530 https://twitter.com/RookieNerdTutor https://plus.google.com/b/117136517396468545840 #
Contents +