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 Link to an External Script

I'm confused... It says I have to many script tags.

Why does it say I have to many script tags?

index.html
<!DOCTYPE HTML>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>JavaScript Basics</title>
  <script>
    alert("I DID IT!!! I think...");
  </script>
</head>
<body>
  <div class="container">
    <h1>Hello Person.</h1>
  </div>
  <script src="shout.js"></script>
</body>
</html>
shout.js

I am still confused... so where would I put it?

Steven Parker
Steven Parker
229,788 Points

The script code goes in the shout.js file. At the top of the editor (the black area) there are tabs representing the files. Click on the name "shout.js" to select that file.

2 Answers

Steven Parker
Steven Parker
229,788 Points

Gabriel's right about putting the alert call in the other file (shout.js). But the error message is pointing out that you have a set of script tags in the head area as well as one in the body of your HTML. The second one is correct, and the first one should be removed entirely.

Also, be sure to use the exact string given in the instructions (just one exclamation, no extra words).

Gabriel Santos
Gabriel Santos
4,113 Points

You have to place the alert function inside the shout.js script

Once you refresh, it will automatically run the script since you have the shout.js linked at the bottom of your page.