"Interactive Web Pages with JavaScript" was retired on March 17, 2017. You are now viewing the recommended replacement.

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! While you're at it, check out some resources Treehouse students have shared here.

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

Stage 3 challenge

I really don't know where to begin with this. any advice? Feel lost this whole unit - like I'm in the wrong level class.

"Challenge Task 1 of 2

Take a look around at the app.js and index.html files. In this task we're going to remove the pleaseEnableParagraph from the body. Do that around line 7. "

For better assistance it's always best when you can post your code along with your question, it will help others troubleshoot the issue for you. If you need help properly formatting your code, you can use the Markdown Cheatsheet that Treehouse provides when posting.

As for the level of the class, did you start with any of the introductory courses to JavaScript before jumping into this one? Like JavaScript Basics, JavaScript Foundations, or jQuery Basics?

sorry of course that would make sense to post the question and code. This is my 3rd Java course. Others were fine; this one is just difficult for me. I think I'm supposed to use .removeChild but am not sure how to formulate.

The original question:

Take a look around at the app.js and index.html files. In this task we're going to remove the pleaseEnableParagraph from the body. Do that around line 7.

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

Barry Barnes
Barry Barnes
18,631 Points

I feel lost too. Like there was too much of a skill jump. Most of this stuff isn't making sense to me.

2 Answers

OK, so in this case you're going to want to use the removeChild function. It's asking you to remove it from the body, which we have stored in:

var body = document.body;

We have the paragraph they are referencing stored in a variable as well:

var pleaseEnableParagraph = document.querySelector("#please_enable");

So, in order to remove that paragraph, we are going to combine some variables with the removeChild function, like so:

//Remove "Please Enable JavaScript" paragraph
body.removeChild(pleaseEnableParagraph);

With that, you accomplish that task.

Aha! I was using quotes inside the (). thanks so much

Barry Barnes
Barry Barnes
18,631 Points

Yeah, I had it kinda backwards.

'remove.body(pleaseEnableParagraph);'

I'm going to push through this lesson. Hopefully, something will stick.