jQuery Events, 6.Hover, UI Bugging


#1

Hey there,

I spotted a bug with the Codecademy UI on Events, 6.Hover.

These were the instructions:

In script.js use your selector to target our menu items
When we hover over the menu item, let's apply a class of active
When our mouse leaves the menu item, let's remove the active class

This is my code:


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

Then, I get this error:

Oops, try again. Please follow the instructions on the Full Preview page to test your code.

No instructions. I double-checked this code on both Codecademy and JSFiddle and still, no result. Can anyone help me?


#2

Your code works,

What this means is that you need to click and open full page view then hover with your mouse over the div and then move your mouse out, you should pass then.

If you still get an error then paste in your HTML, CSS and JS


#3

Hello, I have the same problem, but the error that occurs is "Oops, try again. Unable to get property '1' of undefined or null reference"
My code goes like this:
$(document).ready(function(){
$('div').hover(
function(){
$(this).addClass('active');
},
function(){
$(this).removeClass('active');
}
);
});


#4

To mark the lesson as done, i also click on each div and it passed.
Just a hint.


#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.