The n Shortcut 2


#1

This is my 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) {
$('.current').children('.description').toggle();
var currentArticle = $('.current');
var nextArticle = currentArticle.next();

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

};

$(document).ready(main);

But this keeps popping up: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.

Any suggestions?


#2

I am getting the same problem :sweat:.Any one who has cleared this task please help!


#3

Hi Brandie,

You need to close your if statement before your else if statement, and you need to toggle the current article's description inside the if statement.


@aditya359 If that ↑ doesn't help you, could you please create a new topic with your code, a link to the exercise you're on, and the error message you're getting?
Thanks :)