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 Loops, Arrays and Objects Tracking Data Using Objects Accessing Object Properties

Why do we write <p> element tags if we aren't writing actual HTML?

.

1 Answer

Steven Parker
Steven Parker
229,732 Points

Inside the quotes, you are writing HTML, which the script then delivers to the page as content within the existing div element with an ID of "output". Then, the browser renders the HTML just as if it had been in the "index.html" file to start with.

In later courses, you'll learn ways to directly create elements in code and then attach them to the document, and with a much greater level of control.