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 trialDione Marshall
6,184 PointsHow do you set the class?
Need help setting the class.
let newParagraph=document.createElement('p');
newParagraph
<!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>
2 Answers
Tray Denney
Courses Plus Student 12,884 PointsHey Dione! To set the class means to set the class name of the newParagraph element.
I have tested this method on the challenge and it worked but I don't feel that giving you the entire answer is beneficial to your learning so here is some documentation for how to set a class to an element. Hope this helps and good luck!
https://developer.mozilla.org/en-US/docs/Web/API/Element/className
Briain Corroon
13,689 PointsnewParagraph.className = "panel";
This adds the class "panel" to the paragraph element.
Dione Marshall
6,184 PointsDione Marshall
6,184 PointsYeah still having trouble the way the question is worded is confusing me.