0
Why both the code show different output if the logic is same ?
https://code.sololearn.com/W72zlEFcx41m/?ref=app And https://code.sololearn.com/Wq09d9TtdJwZ/?ref=app
5 Answers
+ 2
I wouldnât recommend doing it this way as it may lead to some confusion but here you go.
You have parentheses in the wrong places. It should be:
document.getElementById("demo").appendChild(document.createElement("p")).appendChild(document.createTextNode("HI"));
+ 2
Please paste your codes in the Code Playground and share the links. It would make it easier for people to help you. Thanks!
+ 2
...what Diego Acero wrote, and you can add this to the end of your scripts to examine the generated HTML for clues:
setTimeout(function(){alert(document.all[0].outerHTML)}, 50);
0
Diego Acero ans Kirk Schafer now check it please...
0
Diego Acero Thank you so much I was just trying what might be some other ways to achieve the same result.