6.Hover


#1

Having the same problem. My code is working but lesson won't let me pass. Tried several refreshes. Still won't work. I used "this" keyword.

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

});

6. Hover. Need Help!
#3

^This first part (hover) is correct only when closing bracket you need to close the function ) so }, will become });

The second part

4. The second function(){} will be called when our mouse leaves the object. This is where we remove the class highlight

so you need to select div again and add mouseleave like so:

$('div').mouseleave(function(){
      $(this).removeClass('active');
 });

#4

A post was split to a new topic: 6.Hover


#5