Wants me to add the $(document).main.(ready) line again, but it's already there


#1



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


The code seems to work fine. N and O work as expected, but I can't get rid of the error message
"Oops, try again. Add the line $(document).ready(main)"


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


#2

The link above points to the second lesson, Program skeleton. It would seem you got a little ahead of the instructions. Empty the function body and leave only the skeleton.


#3

LOL. Thanks, mtf. I never would have seen that. I really appreciate your help here.


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.