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 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> ");

Nancy Melucci
Nancy Melucci
Courses Plus Student 35,157 Points

Most browsers have a developer tool or add-on you need to access to see the code. Which browser are you using?

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,722 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.