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 JavaScript and the DOM (Retiring) Making Changes to the DOM DOM Manipulation

Ali Sh
Ali Sh
2,026 Points

What is the class of panel?

Set the class of panel to the newParagraph.

app.js
const contentDiv = document.getElementById("content");
let newParagraph = document.createElement('p');
index.html
<!DOCTYPE html>
<html>
    <head>
        <title>DOM Manipulation</title>
    </head>
    <link rel="stylesheet" href="style.css" />
    <body>
        <div id="content">

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

3 Answers

The wording of this question confused me too. It is asking you to give newParagraph a class attribute with the value of panel. so through javascript methods add class="panel" to the markup for newParagraph.

I know thats not a great explanation but hopefully it is helpful.

Adam Beer
Adam Beer
11,314 Points

Hi Ali. Just add "panel" className to newParagraph. Like this:

newParagraph.className = "panel";
Ali Sh
Ali Sh
2,026 Points

i used this code and still wrong

Adam Beer
Adam Beer
11,314 Points

So you use it? It works for me.

const contentDiv = document.getElementById("content");
let newParagraph = document.createElement("p");
newParagraph.className = "panel";
Jordan Bass
Jordan Bass
3,183 Points

Thanks, Adam. That worked for me.

Adam Beer
Adam Beer
11,314 Points

I'm happy to help. Cheers! :)