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.