"Hover" Works but won't pass


#1
 $(document).ready(function() {
$('div').mouseenter(function() {
$("div").fadeTo('fast', 1);
});
$(document).ready(function() {
$('div').mouseleave(function() {
$("div").fadeTo('fast', 0.25);
});
});

});

When I mouse into each of the div blocks they fade. I even pause for 3 seconds on each block as well as pause 3 seconds before clicking "next". Still won't work. I get the error: "Oops, try again. It doesn't look like your background color changed, is your hover adding the class active?" My hover IS adding the class.

I know this is a common problem so I'm hoping it has something to do with my code, rather than there being something wrong with Codecademy.


#2

Hi Tyler,

You only need one $(document).ready();, but everything needs to be inside that. Try making your code more like:

$(document).ready(function() {
  $('div').mouseenter(function() {
    // do stuff
  });
  $('div').mouseleave(function() {
    // do stuff
  });
});

#3

Ah yes. Oversight on my part. Thank you and I shall correct my code when I get home.