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 Hello, JavaScript! Add JavaScript to HTML

Workspace not working correctly.

I'm following this step by step and it is not working correctly in the video index.html is not showing up in the correct order or correct folder in the workspace.

1 Answer

Hi William!

I'd have to see your code and your workspace folder tree to really know what is going on.

But, for starters, make sure that your workspace "JavaScript Basics..." folder contains a css folder, index.html, and a js folder.

The css folder should contain the style.css file and the js folder should contain the files preview.js, script.js and app.js (if you made an app.js file).

If that's the case and you typed your code just as Guil did, you should be OK.

I did create an app.js file, so my HTML code looks like this:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>JavaScript Basics</title>
    <link href="css/style.css" rel="stylesheet">
    <script src="js/script.js"></script>
  </head>
  <body>
    <main>
      <h1>Hello, JavaScript!</h1>
    </main>
    <script src="js/app.js"></script>
  </body>
</html>

My script.js code:

alert("Hey, you're back for more?");

My app.js code:

alert("Another message from inside index.html");

I hope that helps.

Stay safe and happy coding!

Peter you are correct. This is how i fixed my problem too.

I dug deeper and noticed that whenever I clicked on create a workspace under the video for the section, it would not setup the template correctly. I ended up just creating a new workspace with the existing template to have the Folder Tree setup correctly.

Here is a link to the quick step by step question I answered as well if anyone needs it.

https://teamtreehouse.com/community/im-not-getting-the-same-view-after-creating-scriptjs-and-linking-it-to-indexhtm-i-see-a-index-of-page-with-2-items