Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Interactive Web Pages with JavaScript Traversing and Manipulating the DOM with JavaScript Appending and Removing Elements

10,791 Points

Unable to Append the new Paragraph. Please help.

Man, this stuff is tough. I just can't wrap my head around this stuff. Again, the first two of three sections were no problem but this third section is wiping me out. Can anyone help? What am I doing wrong? I've looked at my code and watched the video three times and I'm still not getting it. Any help is appreciated. I can do the first challenge but not the second one. Thanks.

var body = document.body;
var newParagraph = document.createElement("p");
var pleaseEnableParagraph = document.querySelector("#please_enable");

//Remove "Please Enable JavaScript" paragraph


//Append new paragaph to document
<!DOCTYPE html>
    <p id="please_enable">Please Enable JavaScript</p>

    <script src="app.js"></script>

2 Answers

Erik McClintock
Erik McClintock
45,783 Points


You've got two fairly small errors here: The task is instructing you to append the "newParagraph" element to the BODY, but you're currently appending the "pleaseEnableParagraph" element to the DOCUMENT.

You want:




I know the comment in the text editor is confusing, but the true instruction is up above on that page :)


10,791 Points

Ah, OK (duh!!) . HAHAHAHA. :) I couldn't help but laugh at what I did. It's the words that threw me. Thanks, Eric!