[SOLVED] The O shortcut - 7 NEWS READER


#1


var main= function(){
$('.article').click(function(){
    $('.article').removeClass('current');
    $('.description').hide();
    $(this).addClass('current');
    $(this).children('.description').toggle();

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

}

$(document).ready(main);


Hello Guys,
I have been stuck for 2 hours on this one. The following error message keeps appearing:
"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."

Everything looks good to me. I have done some back and forth with similar topics, but I certainly cannot find my mistake.

Would you be so kind as to help me on this one?

Thanks a lot,

Chris



#2

need to close after

var main= function(){
$('.article').click(function(){
$('.article').removeClass('current');
$('.description').hide();
$(this).addClass('current');
$(this).children('.description').toggle();
}); <=see need to close here

but you did

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

so remove second one and add }); to appropriate position

and
At last add $(document).ready(main);

@christouffe


#3

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.