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 and the DOM (Retiring) Responding to User Interaction Functions as Parameters

Code doesn't run from temp.js

I have entered the same code as in the video in my workspace. When I load and refresh the page, the function does not run and the console does not log anything. However, if I manually paste the code into the console, it works. Does anyone know why this is happening? I would like to get the function running automatically. My temp.js is linked the index.html

3 Answers

Erin McCulloch
Erin McCulloch
10,098 Points

This exact same issue is happening to me. The code works if I paste it into the browser console but won't run from the workspace preview. I have the code saved and the js file is linked correctly in the index.html file.

Not Knowing what your code looks like I know I had issues getting it to work as well. when i finally got it to work it looked something like this. https://w.trhou.se/u01128rns1 Edit: Wrong URL

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there, Ian! There are a couple of possibilities here. So let's check some basics first. First, make sure your file is saved. If there's an orange dot on the tab, it means that the file has changes that haven't yet been saved. Because you've already tried refreshing the page, we can rule that out. However, it is possible that your browser is loading in old cached data instead of your newly altered JavaScript. Try clearing the browser cache or launching in a new private tab and see if it will run then.

If none of these work, we're going to need to see a snapshot to your workspace. You can create a snapshot by clicking the icon on the upper right-hand side of your workspace and link it to us here.

Hope this helps! :sparkles: