The o Shortcut #7


#1

Now I have been stuck for like 30 mins on this one. It looks like the code is right but will not pass.

I get this Opps'

> Oops, try again. 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.

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

$(document).ready(main);

#2

Hi Zac,

Line 1, you need to remove the 'click' between the parenthesis, since the function shouldn't be taking any parameters as inputs.
Line 2, you need to select .article (the dot (.) is important)

Good luck with the rest of the course!


#3

Ahh it's the small things that help you remember this stuff. Thanks a bunch.


#4

can somebody tells me what is missing, is telling me that is wrong and I'm cant find the error
var main = function() {
};

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


#5

@ptcha Please create a new topic with the exercise you're on, the error message you're getting, and your code. Someone will help you over there :)


#6

thanks, I will do that