What is wrong?


#1

$(document).ready(function(){
$('div').hover(function(){
$('div').addClass('active');
},
function(){
$('div').removeClass('active');
});
});

mistake: "Oops, try again. It does't look like your background color changed, is your hover adding the class active?"


#2

On line 3 and line 6, you're using ('div') as the object being altered. That effects all of the divs. How could you change it where it will only add the class to item being hovered over?


``` $(this).addClass('active'); ``` and ``` $(this).removeClass('active');
If you set the two events to only effect 'this' and it still doesn't work, delete the line where you add the class and retype it instead of copying and pasting.

#3

$(document).ready(function(){
$('div').hover(function(){
$(this).addClass('active');
},
function(){
$(this).removeClass('active');
});
});

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


#4

The full preview page gives you instructions in the bottom left corner, right by the "back to editor" button. The error is because you didn't follow them all.


#5

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