O Shortcut Bug


#1

I have made the programming exactly the way it wants it, the o key open it up, and it still says I am wrong. The only explanation that I can think of is a bug. Someone please fix it or tell me how to do it. Here is my coding:
var main = function() {
$('.article').click(function() {
$('.article').removeClass('current')
$('.description').hide();

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

}
});

$(this).addClass('current');
$(this).children('.description').show();

});
};

$(document).ready(main);


#2

Hi Barker,

The layout for your code should look like this:

var main = function() {
  $('.article').click(function() {
    // ...
  });

  $(document).keypress(function(event) {
    // ...
  });
}

and not:

var main = function() {
  $('.article').click(function() {
    // ...

  $(document).keypress(function(event) {
    // ...

    });

    // ...
  });
}

Your closing curly braces (}) and parenthesis ()) are in the wrong places.

This should get you started, if you need more help, please post a link to the exercise :slightly_smiling: Thanks!