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 jQuery Basics (2014) Introduction to jQuery Include jQuery in a Project

Problem with JQuery

I have this Bummer: Bummer! You didn't use the CDN hosted version of jQuery. Try again. What I'm doing wrong?

index.html
<!DOCTYPE html>
<html>
<head>
    <title>Take Evasive Action</title>
    <link rel="stylesheet" href="css/style.css" type="text/css" media="screen" title="no title" charset="utf-8">
</head>
<body>
    <p class="warning">
      <span>It's A Trap!</span>
    </p>
    <div class="image">
        <img src="img/ackbar.gif">
    </div>
    <script src="js/app.js" type="text/javascript" charset="utf-8"></script>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
</body>
</html>

2 Answers

Maxime Duhamel
Maxime Duhamel
7,169 Points

Hi,

You should put your CDN in your head element. Your html is read from top to bottom and it runs into your app.js before it loads jquery cdn. It's a bit like trying to read a book in a language you didn't even learn yet. If my understanding is good with this you could even just reverse your 2 script tag at the end of the body element.

Hope i helped

Max

nico dev
nico dev
20,364 Points

Hi Emmanuel Jimenez,

Technically, you're not doing nothing wrong. The one you linked to is the CDN-hosted jQuery file. And you're linking to it before closing the <body>.

However, if you go on reading what the challenge is asking from you, you'll notice it says:

Find the CDN hosted jQuery javascript file on the code.jquery.com

The one you linked to is not found in code.jquery.com, but comes from Google libraries, if I'm not wrong.

This great answer from another student will guide you the right way. I know it helped me (and many others too!).

But if after taking a look at that, you remain in trouble with something, feel free to follow up right here. :)