What is wrong with my code it keeps giving error


#1



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

Hi Anna,

$(document).ready(main);

};

You can't call a function from inside the same function like that, or you'll run into an infinite loop. Swap the order of the two lines shown above; your code should end like this:

};

$(document).ready(main);

#3

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