I don't know what's wrong?


#1



https://www.codecademy.com/en/courses/web-beginner-en-4hxyb/0/7?content_from=make-an-interactive-website%3Ajquery-events#


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() {
    $(document).keypress(function(event) {
  if(event.which === 111) {
    $('.current').children('.description').toggle();
  }
});
    $('.article').removeClass('current');
    $('.description').hide();

    $(this).addClass('current');
    $(this).children('.description').show();
  });
};
$(document).ready(main);


#2

@bobymashoby
You pasted in the document =keypress= Eventhandler

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

into the middle of you article =click= Eventhandler

$('.article').click(function() {
    $('.article').removeClass('current');
    $('.description').hide();

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

#3

I think I am having the same problem but I don't understand your solution as you have written it. I especially don't follow the sentences: "...in the document =keypress= Eventhandler" and "into the middle of you article =click= Eventhandler" Thank you