0

Why this script is not working ? Is there something wrong

<body> <div id="d"> <p id ="p0"> hello </p> </div> <script> var p1 = document.createElement("p"); var hi= document.createTextNode("hi"); p1.appendChild (p1); var pare = document.getElementById("d"); var child = document.getElementById("p0"); pare.replaceChild(p1, p0); </script> </body>

13th Sep 2020, 1:27 PM
Djaber Meghar
Djaber Meghar - avatar
2 Respostas
0
Plz post code in playground instead of code in description.
13th Sep 2020, 1:36 PM
Divya Mohan
Divya Mohan - avatar
0
I think you should write P1. appendChild(hi) ;
13th Sep 2020, 1:39 PM
Divya Mohan
Divya Mohan - avatar