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

Ben Ahlander
Ben Ahlander
7,528 Points

Trying to attach Jquery CDN to index file

why is this not working

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="//code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
</body>
</html>

4 Answers

Jean-Paul REMAN
Jean-Paul REMAN
6,004 Points

1 - Call jQuery script before your script 2 - The URL of of jQuery is bad ( script src="https://.......")

Mary-Ann Burton
Mary-Ann Burton
15,834 Points

Mainly its a lack of the https:// from your url. Then it should work.

Jean-Paul REMAN
Jean-Paul REMAN
6,004 Points

call jQuery before app.js, because the script in the file app.js needs jQuery

Christopher Debove
PLUS
Christopher Debove
Courses Plus Student 18,373 Points

URL starting by "//" is totally valid. It's just infering the protocol from yours. Then if you're not running you page from a server it will not reach the file, thus the use of "http://" or "https://"