6/12 Can't Find My Mistake


#1

I've tried and tried on this exercise but I can't seem to find what I've done wrong. Please help!

This is my error message:

Uncaught SyntaxError: Unexpected token )


And this is my code:

$(document).ready(function(){

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

});


#2

Hi @anathemastyles,

If it may helps please see the code sample below.
In short just a little gremlin syntax here: There was one too many closing parens in the code, by closing the parens out after the associated hover function you closed that function out and caused the next one to be incorrect for JQuery. Hopefully the example will explain better than my rush attempt here at words :slight_smile:

$(document).ready(function(){

  $('div').hover(function(){
        $(this).addClass('active');
    }, // )this paren here closed out the function above and caused the following function not to be correct for executing.
    function(){
        $(this).removeClass('active');
    });

});

#3

Thank you so much!!!!!!!!!


#4

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