Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript Interactive Web Pages with JavaScript Traversing and Manipulating the DOM with JavaScript Modifying Elements

Not Sure what to do

I am not sure what to do with this challange

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

// Add text to the new paragraph



//Remove "Please Enable JavaScript" paragraph

body.removeChild(pleaseEnableParagraph);

//Append new paragaph to document

body.appendChild(newParagraph);
index.html
<!DOCTYPE html>
<html>
  <body>
    <p id="please_enable">Please Enable JavaScript</p>

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

2 Answers

Hey Andrew,

This challenge wants you to add text to the new paragraph that is created. The way you can do that to text based elements such as paragraphs, divs, sections, spans, etc. is to modify either their textContent/innerText or innerHTML property. Using those text properties allows you to add/replace any text data within the element. Using the innerHTML property can allow you to add text and/or elements to another element. The text properties are faster to use than the HTML property. So, any of those properties are valid ways to set the text in the element.

newParagraph.textContent = "JavaScript is enabled";
//or:
//newParagraph.innerText = "JavaScript is enabled";
//or:
//newParagraph.innerHTML = "JavaScript is enabled";

I am no javascript expert, but from the looks of the question it looks like it wants you to tie a paragraph to a document using javascript.

Sorry i could not be of more help.