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
Samuel Glister
12,471 PointsjQuery Newbie
Hi All,
After mastering HTML and CSS I'm trying to now find my way with Javascript and jQuery.
As a small test of what i've learnt so far i'm trying out a fadeOut effect but can't seem to get it to work!
Here is my code.
<!DOCTYPE html>
<html>
<head>
<style>
.square {
background-color:red;
width:100px;
height:100px;
display:inline-block;
}
</style>
</head>
<body>
<div class="square"></div>
<div class="square"></div>
<div class="square"></div>
<script type="text/javascript" src="js/scripts.js"></script>
<script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
</body>
</html>
$(document).ready(function(){
$('div').click(function(){
$(this).fadeOut('slow');
});
});
Does anyone have any idea why this isn't working?
Thanks!
3 Answers
Steven Bister
12,011 PointsHey man,
All you need to do is add http: in front of your JQuery link. It should read like this:
http://code.jquery.com/jquery-1.11.3.min.js
It's caught me out loads of times
Hope this helps!
ivannnnn
58 PointsYou need to add your script after the jQuery script.
Samuel Glister
12,471 PointsThank you both! I tried adding the http: to the front of the link first which didn't work so I then changed the order and this solved it! :)
Thank you