The n shortcut 2


#1



It says error, but I can't find the mistake...


Replace this line with your code. 
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();
        
          currentArticle.removeClass('current');
          nextArticle.addClass('current');
        };

};

$(document).ready(main);


#2

@nmmn231,
You are forgetting to close the document =keypress= Eventhandler with the closing-set });


#3

@leonhard.wettengmx.n Thanks a lot! It's working now.


#4

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