jQuery 9/10


#1

I have the following code that does not seem to trigger any error except for the
" Oops, try again. It looks like the n key isn't moving to the next article. Remember to remove the 'current' class from currentArticle and place it on nextArticle."
Would you please review it below:

var main = function() {
    $('.article').click(function() {
        $('.article').removeClass('current');
        $('.description').hide();
        $(this).addClass('current');
        $(this).children('.description').show();
    });
     $(document).keypress(function(event) {
     if ( event.which === 111 ) {
       $('.current').children('.description').toggle()
     }
     else if ( event.which === 110 ) {
       var currentArticle = $('.current');
       var nextArticle = currentArticle.next();
       currentArticle.removeClass('current');
       nextArticle.addClass('current');
     }
     }
    });

$(document).ready(main);

#2

@devrockstar41094,

your complete IF ELSE-IF statement

if ( event.which === 111 ) {
   $('.current').children('.description').toggle()
}
else if ( event.which === 110 ) {
   var currentArticle = $('.current');
   var nextArticle = currentArticle.next();
   currentArticle.removeClass('current');
   nextArticle.addClass('current');
}

leaving you with 1 closing-curly-bracket-} to many


#3

Apologies, but I still do not seem to get it


#4

Maybe I'm, mistaken, but the only difference between my own code devrockstar's was the last two curly brackets. Mine ends with this:

        }
    });
};

So instead of two curly brackets with nothing behind them, you should have just one. With the other two looking like mine above.


#5

Same, having problems...