Error with the instruction/example


#1

The instruction shows

$('div').hover(
    function(){
      $(this).addClass('highlight');
   },
   function(){
      $(this).removeClass('highlight');
   }
);

I tried it but it shows error,until

$(document).ready(function(){

  $('div').hover(
    function(){
        $(this).addClass('active');
        }
    
    ),<---Here!
    function(){
        $(this).removeClass('active');
      
    };

});

I changed the '}' with ')' and it worked. please review it because it made me stuck for minutes.


#2

That ) is correct as it closes the hover( bracket.

Could you paste in the lesson URL so we can have a closer look


#3

Sorry im wrong. it is all working fine. i just putted some typo error.


#4

$(document).ready(function(){

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

});

That code is correct and hover state seems to work perfectly, however its throwing error: Oops, try again. It does't look like your background color changed, is your hover adding the class active? ...I don't know if its bug or not!


#5

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