Codecademy jQuery track

Soldato
Joined
1 Mar 2003
Posts
5,508
Location
Cotham, Bristol
So I'm attempting to teach myself something new, codecademy usually gives a pretty good starter to these things, albeit sometimes a bit too easy and repetitive.

However I've got to part 11/13 ('Get yourself in....'/Introduction to jQuery) where it asks

Using the examples above, make it so your 'div' fades to 1 (100%) opacity when your mouse enters the 'div'. Make the animation speed 'fast'. (Make sure to give fadeTo() its inputs in order—speed, then opacity.)

It gives the following html

Code:
<!DOCTYPE html>
<html>
	<head>
		<title></title>
	</head>
	<body></body>
</html>

A blank stylesheet and a blank script, so I quickly typed in the following just to get on to the next lesson

Code:
<!DOCTYPE html>
<html>
	<head>
		<title></title>
		<link type='text/css' rel='stylesheet' href='stylesheet.css'/>
		<script type='text/javascript' src='script.js'></script>
	</head>
	<body><div>This is a div</div></body>
</html>

Code:
div {
    height: 60px;
    width: 100px;
    background-color: green;
    text-align: center;
    color: #FFFFFF;
}

Code:
$(document).ready(function() {
   $('div').mouseenter(function() {
      $('div').fadeTo('fast',1);
   });
});

I can't see anything wrong with this (I could be going blind). But it says 'Oops, try again. Make sure you have defined all the variables!'

So have I made a mistake or is the track buggy?
 
Last edited:
Back
Top Bottom