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 Where Does JavaScript Go?

Gideon Seaman
Gideon Seaman
664 Points

WORKSPACE SHOUD NOT HAVE THE WORD WORK IN IT BECAUSE IT DOESN'T. USER ERROR? MAYBE SO...

In the HTML file:

<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <link rel="stylesheet" href="css/main.css"> <title>JavaScript Basics</title> <script src="scripts.js"></script> <script> alert("Hey, another message"); </script>

</head> <body> <div class="container"> <h1>Where to place your JavaScript code.</h1> </div> </body> </html>

and in scripts.js:

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

This should work but when previewed it does not. I'm beating my head against the wall. The last exercise also did not work for me. No alerts pop up at all. It just says "Where to place your JavaScript" in the middle of the page. I'm using a Macbook, could that be the problem. ARG!

You just need to refresh the preview page. Same thing happened to me and that fixed it.

1 Answer

Aaron HARPT
Aaron HARPT
19,845 Points

Try this: In the HTML file: <title>JavaScript Basics</title> <div class="container"> <h1>Where to place your JavaScript code.</h1> alert("Hey, another message"); and in scripts.js: alert("Hey, another message"); alert("Hey, you're back for more?");