The Code Works, but I'm Told It's Wrong

<PLEASE USE THIS TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>
https://www.codecademy.com/courses/web-beginner-en-JwhI1/1/2?curriculum_id=50a3fad8c7a770b5fd0007a1#
<Below this line, in what way does your code behave incorrectly? Include ALL error messages.>
There seems to be no problems with my code, and it even functions properly when sumbitted/tested (it changes the background color of the boxes) in the preview editor. However, Codecademy leaves the error message:

“Oops, try again. It does’t look like your background color changed, is your hover adding the class active?”

I changed the double quotes to single quotes, and I still receive the message. I also followed the instructions fully on the preview editor (hovering over the div). Does anyone know what’s wrong with my code? Thanks!


$(document).ready(function(){

  $("div").hover(
    function(){
        $(this).addClass("active");
    },
    function(){
        $(this).removeClass("active");
    }
  );

});


Be sure to follow the instructions on the full page preview.

  1. Click inside the window to give it focus
  2. Mouse over a div and pause for two seconds
  3. Mouse off the div and pause for two seconds
  4. Return to editor
2 Likes

Have the same issue with the same problem.
This is the error code: Oops, try again. Unable to get property ‘1’ of undefined or null reference

have the same issue.

I had the same issue. I eventually got it to work by only putting my mouse into only one of the div’s and taking out it.

2 Likes

The same. Will subscribe.

Yup, worked for me!
thanks

1 Like