Need help on "The O Shortcut"


#1

Hello, I can't understand what I'm doing weong:

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

});
}

$(document).ready(main);

then it said:
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.

any idea?


The o shortcut!
The o shortcut
#2

@pablochapab,

1

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

into the middle of your
of your article =click= Eventhandler

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

Have a look at the desired structure of the =main= function in
http://discuss.codecademy.com/t/the-o-shortcut/28546/2?u=leonhard.wettengmx.n


#3

I'm sorry, I didn't understand, could you explain me again?


#4

A post was merged into an existing topic: Need help on "The O Shortcut"