Need help on 7/10 The O Shortcut


#1

I'm having the same issue but can't figure out where I'm going wrong:

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

$(document).ready(main);

7/10 The O shortcut, can't pass exercise
#2

Hi Jumpin Flash,

I see two problems in your code:

  1. the add/remove/toggleClass() functions don't take a dot (.) before the class name. That means use addClass('current') rather than addClass('.current'), and the same for removeClass()
  2. You need to close your $('.article').click(); thing before the $(document).keypress(); thing