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

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
215,954 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!