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 trialYuanjian Liao
451 PointsCan we store a html tag in a variable of string type?
In the solution code, I saw the instructor do something like this: var message = "<h1> some content</h1>"; document.write(message); However, the html tags themselves are not written to the web page.
For example, what I think is shown on the web page is like this: <h1>some content</h1>
Instead, what is actually shown is something like this: some content (in the h2 format)
Can somebody explain what is going on?
1 Answer
Steven Parker
231,128 PointsThe tags are written to the web page. But when your browser displays the page, it uses the tags to determine how to display the contents and does not show the tags.