The 'O' Shortcut #7


#1



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


Error message says "Expected ')'"

I'm not sure what to do, any tips?

Thanks


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();
            $(this).children('.description').show();
            
        }
        
    });
    
};

$(document).ready(main);


#2

Hi Eternale88,

if(event.which === 111 {

Can you spot the problem there?


#3

Hello there,

Yes I did, but now I get this error.

"It looks like the o key isn't opening a description. Remember to toggle the current article's description inside the event handler. Look back at the instructions for the code. "

Thanks


#4

@eternale88 Can you post your updated code, please?


#5

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();
        $(this).children('.description').show();

    }

});

};

$(document).ready(main);


#6

@eternale88 Since you're selecting elements with the article class, rather than the article tag, you need to change:

$('article')

to:

$('.article')