'TextNode' Example : TextNode « Javascript Objects « JavaScript DHTML






'TextNode' Example

 <html> <head> <script> function replaceText(){ var myTextNode = document.createTextNode("Text was replaced"); var newTN = replaceMe.firstChild.replaceNode(myTextNode); } </script> </head> <p id="replaceMe">This is some text that will be replaced</p> <button onclick="replaceText();">Replace text</button> </body> </html> 








Related examples in the same category

close