Make an interactive website: 9: The n shortcut 2


#1

Hey guys, what is wrong with this code?

It says: You have to define all the variables.

var main = function() {
$('.article').click(function () {
$('.description').hide();
$('.article').removeClass('current');
$(this).children('.description').show();
$(this).addClass('current');
});

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

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

};

$(document).ready(main);


#2

@jdprogr,

Have a close look at

currentClass