Can't pass the o keyword shortcut


#1

https://www.codecademy.com/courses/web-beginner-en-4hxyb/0/7?content_from=make-an-interactive-website%3Ajquery-events#


#2

Hi Lilericminecraft,

It's very hard for us to work with code from a screenshot. Please copy/paste your complete code into a post here.
Thanks!


#3

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

}

}


#4

I'm stuck in this exercise too, I've reformatted your code so it's more legible. If you analize it, you'll see that you've putted the keypress event handler inside the article click event handler. I hope it helps you.


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