Replacing child multiple times problems..
Can't seem to click on my button functions to change my text more than one time total. Here is my HTML code, followed by my JavaScript. Perhaps I need an Event handler? HTML <body> <button><div id="demo"> <p id="p1">You are at Home.</p> </button> </div> <div> <button onclick="gotown()">GO TO TOWN</button> <button onclick="gohome()">GO HOME</button> </div> </body> JAVASCRIPT function gotown() { var p = document.createElement("p"); var node = document.createTextNode("You are at Town"); p.appendChild(node); var parent = document.getElementById("demo"); var child = document.getElementById("p1"); parent.replaceChild(p, child); }; function gohome() { var p = document.createElement("p"); var node = document.createTextNode("You are Home"); p.appendChild(node); var parent = document.getElementById("demo"); var child = document.getElementById("p1"); parent.replaceChild(p, child); };