My code works, why can't I go on?


#1

My code looks like this and it works.
When I press o the description box does toggle.
why can't I go onnnn...??

var main = function(){
    $('.article').click(function() {
    $(document).keypress(function(event) {
        if(event.which === 111) {
        $('.current').children('.description').toggle();
        }
    });

        $('.article').removeClass('current');
        $('.description').hide();
        
        $(this).addClass('current');
        $(this).children('.description').show();
        
    });
};

$(document).ready(main);

The o shortcut
#2

HI your code should have that structure

var main = function(){
    $('.article').click(function() {
        ...
    });

    $(document).keypress(function(event) {
        ...
    });
};

$(document).ready(main);