Exercise 9 - Need Help on "The 'N' Shortcut"


#1

can you help me

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();
}

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

currentArticle.removeClass('current');
nextArticle.addClass('current');
});
$(document).ready(main);

this is my code


9. The 'N' Shortcut
#2

@lululemon982,

With

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

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

  });
};

you have closed the =main= function,
and any further code would NOT be part of the =main= function.....