Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript Introduction to jQuery Hello, jQuery! Setting Up jQuery

Michael Stedman
seal-mask
.a{fill-rule:evenodd;}techdegree
Michael Stedman
Full Stack JavaScript Techdegree Student 13,838 Points

Any reason why example would not work on an outside editor?

I have been using the Microsoft Expression Web 4 editor, and just ran into what my first problem might be when not using Workspaces.

First of all, in the project files, there is nothing that deals with this second video and what Aisha Blake demonstrates (with the "Thing..." unordered list. All of the files that get downloaded through the Project Files section, seem to only have something to do with the course project.

So, after I typed up all of the HTML for the index.html file, as well as the same coding for the app.js file, I inserted the embedded script from the CDN just like the instructor did. Yes, I did make sure to put it before the script tag containing the app.js. So, to this point, everything is exactly the same.

However, the page loads with the list visible (as it should), but nothing at all happens when I click on any of the list items. Looking at the JavaScript console, I get two errors:

Here is the quote of the first error that I encountered:

Access to Script at 'file:///C:/Users/Stedman/Documents/Treehouse/TreehouseCourse/FullStackJavaScript/6_IntroTojQuery/1_Hello%20jQuery/jquery-3.1.1.min.js' from origin 'null' has been blocked by CORS policy: Invalid response. Origin 'null' is therefore not allowed access.

Here is the quote of the second error that I encountered:

Uncaught ReferenceError: $ is not defined

Just to add, I went ahead and opened up Workspaces and followed along once more using it, and everything worked fine. So, is there a reason that using another editor would cause this to happen, or can you tell me what is happening?

1 Answer

Would be easier to assess if you uploaded your code. My guess is that there is a typo somewhere, or you might have adblock or something similar blocking the file. The second error comes from jQuery not being loaded.