9.The n shortcut


#1

Again,cant see the problem,newbie..
The issue: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.
Here is the code:

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)

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

currentArticle.removeClass('current');
nextArticle.addClass('current');

}

$('.current').children('.description').toggle();
}
});
}

$(document).ready(main);


#2

@etthegeek,
You Pasted-In
your ELSE IF

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

   currentArticle.removeClass('current');
   nextArticle.addClass('current');
}

into the middle of your IF

if(event.which === 111) 
     $('.current').children('.description').toggle();
 }

#3

Get it,Thank you so much!!:slightly_smiling: