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


Bradley Wise
Bradley Wise
405 Points

Every time I use the document.write(); function it does not work.

When I use the document.write(); function, nothing happens. I write the command, view to see what it did and it did nothing. What is wrong.

1 Answer

Adrian Patrascu
Adrian Patrascu
15,279 Points

Hi Bradley,

Can you please share your code how you do it? Please see the documentation from W3Schools about the method: http://www.w3schools.com/jsref/met_doc_write.asp Try the methods from over there. If you are trying to write HTML elements see also the following example:

Example Write HTML elements with text directly to the HTML document:

document.write("<h1>Hello World!</h1><p>Have a nice day!</p>");

Thank you, Adrian