N shortcut not working for me


#1

Not sure where I'm missing something but I can't seem to get the N shortcut to work:

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


#2

@thadicalradical,

You are using the semi-colon-; in your IF ELSE-IF statement structure.

The semi-colon-; is an End-of-Statement indicator for the Javascript-interpreter,
causing your ELSE-IF statement-part not being seen as part of the IF ELSE-IF statement.