The n shortcut 2


#1




<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.


Replace this line with your code. 
<else if(event.which === 110) {
  var currentArticle = $('.current');
  var nextArticle = currentArticle.next();
}
 currentArticle.removeClass('.current')
  nextArticle.addClass('current');


#2

I am able to submit with no errors, however when I go to run it, the 'current' class does not get applied to the next article.

var main = function(){

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


#3


else if(event.which === 110) {
var currentArticle = $('.current');
var nextArticle = currentArticle.next();

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

$(document).ready(main);
});


#4

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