I need help on the "o-shortcut"


#1

I am doing the "interactive website: News reader" lesson

This is my code:

var main = function(){
$('article').click(){
$('.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);

If i submit my code the following message appears:
"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."

Can someone help me with this i checked the Q&A forum multiple times but i can't find a solution for my problem.


#2

@terawhiz81115,

the structure of our main-function looks like:

var main = function() {
     //BEGIN of main function-body 
    //
    //The CLICK event-handler is

    $('.article').click(function() {

     });

     //now comes the KEYPRESS event-handler

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

       });
   //END of main function-body
   };

  $(document).ready(main);

#3

thank you! i changed the code and now it works. I appreciate it. :slight_smile: