7 The o shortcut


#1

I've tried this in a few different ways and still telling me

"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() {
$('.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);

What am I not seeing.


#2

I'm having the exact same problem. My code matches everything told and is actually the same as your and I keep getting the "Oops, try again" message. I have no idea how to make it correct. And if we're doing something wrong then it's a fault in the instructions because I did everything the instructions said.


#3

Okay so I actually had a mistake I was missing the . before ('.description')
For your code some aren't fully closed you're missing a ) after

it should be }); not };

And at the very end before $(document).ready(main) you're missing two closings a } and a };


#4

I am having the same issue... I must be missing something. Help?

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

};

$(document).ready(main);


#5

I'm wondering if there is an error. If you skip to the next page, it should already have the completed, correct code for you to build onto the "o" shortcut. If you take that code and plug it back into the "o" page, it still shows as an error...


#6

J'ai trouver: 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) {
$('.description').hide();

  $('.current').children('.description').show();
}

else if(event.which === 110) {
  var currentArticle = $('.current');
  var nextArticle = currentArticle.next();
  
  currentArticle.removeClass('current');
  nextArticle.addClass('current');
}

});
}

$(document).ready(main);