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

First excercise

<head>
<title> JavaScript Foundations: Variables</title>

    <style>

      html {

        background: #FAFAFA;

        font-family: sans-serif;

      }

    </style>

  </head>

  <body>

    <h1>JavaScript Foundations</h1>

    <h2>Variables</h2>


    <div id="myDiv">
      This is a div with the id of "myDiv"
    </div>

    <script src="myscript.js"></script>


  </body>

</html>

And for js:

/*  JavaScript Foundations:  Variables  */

var color = β€œred”;

document.getElementById(β€˜myDiv’).style.background =  β€œblack”;

When I open the file in Chrome, the Black background doesn't display.

http://s27.photobucket.com/user/MaxReinsch/media/yep.png.html

image

Jim Hoskins

2 Answers

Your quote characters are the issue, try retyping them.

Do you know what the issue specifically was?

I think I wrote some of the code in ms word (for some reason I can't open two notepad docs at the same time) and pasted it into the workspace.

Thanks James, it worked.

> think I wrote some of the code in ms word

That's your issue, your quotes weren't normal quotes they were "smart" quotes which look better typographically but are actually distinctly different characters and those programming languages don't recognize them.

> I can't open two notepad docs at the same time

Use notepad++ instead, it has tabs and syntax highlighting.

Does it work if you open up the javascript console in chrome dev tools and apply the styles manually?