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 JavaScript Basics (Retired) Introducing JavaScript Your First JavaScript Program

Stoicescu Sebastian
Stoicescu Sebastian
3,728 Points

The browser doesnt display my javascript code !

I got a problem since I started my JavaScript course. My browser doesn't display my code that I write in Javascript , in short it displays nothing(a blank page) when I click the prieview butoon. Have you encountered this problem? Let me know please. This is what I wrote so far: alert("Hi from Treehouse"); document.write("<h1>Welcome to JavaScript Basics</h1> ");

Stoicescu Sebastian
Stoicescu Sebastian
3,728 Points

Meanwhile I managed to solve it somehow. Maybe it was just a bug. Thank you however.

3 Answers

Michael Robinson
Michael Robinson
1,924 Points

I don't know about anyone but for me, my code wouldn't display because apparently there are two different types of quotation marks.

It's hard to explain, but one of my quotations marks looked different than the other.

I simply deleted the one that looked different and copy and pasted the other one in its place. It worked!

This was just trial and error and looking closely. I am a newbie like everyone else.

Dawn Reel
Dawn Reel
433 Points

Yep, Macs sometimes default to use these cute quotation marks that kind of wrap around the quote. You want to use the marks that are the same thickness from top to bottom AND that are either straight up and down/vertical, or only slightly not vertical. Like this: "Example".

Samuel Ferree
Samuel Ferree
31,718 Points

What does your html file look like?

The preview button is probably going to try and load the index.html file, and it's in there that you need to use the <script> tag to link your javascript.

Hello i have the same problem here too, it shows the alerts but with a empty page then!! i am using google chrome, I've tried another browser, so please help.