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 trialAnaruth Hernandez
743 PointsAlert prompt showing up directly underneath the "Hello, Javascript" in the webpage, neither message shows up in box
I am adding a snapshot of my workspace below, as I 've spent several hours on this issue now. https://w.trhou.se/ws2l8x0ess
I'm listing most of the solutions I've tried so far and the progress I've made below.
The issue started out simple enough, the initial prompt was not showing (don't remember I could see blue background initially, as it's been too long now.) then I got this error:
Definitely no blue background, instead a weird formatting:
"Index of/ Name Last Modified Size Decription Image of folder css/ 2019-12-09 15:01 Image of js/ 2024-07-31 20:19"
At this POINT I tried switching from Edge browser to Chrome browser upon the answer in a post by Nicolas Hu Posted on Feb 19, 2021
The solution was to stick to chrome - which I was trying, but this entire post detailed instructions to opening a "Different Workspace" versus "Launch Workspace" and this yielded results! I was able to get the blue background again!
However, most still prompt NOT showing up.
I found another answer that said to remove add blockers I did.
No luck and now there is the error I mention in the title.
"Hello, JavaScript! alert("Another message from inside index.html ");"
One last possible explanation was given by a different response, something about alert being read or interpreted as a modal... anyone know if this is correct? At this point I'm concerned I just won't be able to add js files to HTML files with my laptop, will try moving forward with the lesson for now.
If you've made it this far - thank you for taking the time to read through this! and thank you to all of the other posters, it's been super helpful to try to figure things out.
1 Answer
Steven Parker
231,275 PointsThis project involves three code components, each in a different language:
- the HTML code to define the basic page content
- the CSS code for appearance and styling (such the blue background)
- the JavaScript code for functionality, including pop-ups ("modals")
The JavaScript portion isn't currently being used because the HTML code says it should be loaded from "js/script.js" (in the "js" folder), but that file is currently located in the same folder as index.html. To make it work, either move the file into the "js" folder (recommended), or change the reference to point to where it is now.
Then, the alert("Another message from inside index.html ");
line is a JavaScript command, but it is currently located inside the HTML file. It should either be moved into the script.js file (recommended), or surrounded with <script>
tags.