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 trialsarah sanger
50 PointsThe script in script.js will cause an the alert, but doesn't when I write it into the index file, the second alert works
rel="stylesheet"> <script src="js/script.js"></script> <script> alert("Another message from inside index.html") </script>
3 Answers
Bob Swaney
13,010 Pointshello. what do you mean that it doesn't cause the alert when you write it into the index file? If you load up the HTML page and the .js file is causing the alert and the second alert is working, isn't that what you are looking for? if the alert from the .js file is firing, then you have it linked up to the HTML correctly.
mohamed adam
Full Stack JavaScript Techdegree Student 11,884 Pointshello, does it work when in the html or when it is in the js file? may be you did not link up properly? take screenshot of the whole screen so we can have a look.
Stijn Vanthournout
688 PointsI also only get the second alert "another message" to work. The first one doesnt run.