What is wrong? - The n shortcut 2 9/10


#1



https://www.codecademy.com/pt/courses/web-beginner-en-4hxyb/0/9?content_from=make-an-interactive-website%3Ajquery-events

The following message error appears: 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.

I have a long time on this exercise, and don't found it the solution.


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);

@edit
I resolved using this code.
In this case , they are missing the dot.
Thanks for all.


var main = function() { 
   $('.article').click(function(){
        $('.article').removeClass('.current'); 
        $('.description').hide(); 
        $(this).addClass('.current');
        $(this).children('.description').show(); 
   }); 
   $(document).keypress(function(){ 
        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

Hi I just ran you code and it works fine try to refresh the page or change browser..