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

Ed She
Ed She
6,047 Points

Anyone know how to solve the previous challenge?

I don't think I fully get the task requirement.

Are we inserting a class, so like "class = 'highlight'", into <button></button>'s previous element which is the <p> </p> so that the result would look like <p class = 'highlight'> </p>?

If I am understanding it correctly, how exactly should I code it using what we've learned so far?

1 Answer

Steven Parker
Steven Parker
229,744 Points

You should set the element property directly.

Once the element has been created, you are no longer concerned with the HTML code used to construct it. At this point, you should only use properties and methods of the element object to add the class to it.

Ed She
Ed She
6,047 Points

Thank you Steven! I got it worked!