The N Shortcut It does not work


#1



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


I does not work and I don't know why..

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




    
 });
 
 
};

  
    $(document).ready(main);


#2

Hi your code should have this structure

var main = function () {
    $('.article').click(function() {
        ...
    });

    $(document).keypress(function(event) {
        ...
    });
}
$(document).ready(main);

#3

Thank you for your reply! This solved the Problem i had with the "o" shortcut, that didnt work constantly. Now it is fixed.
But the "n shortcut" does not work on top of that..


#4

oh sorry, i see that there is "the n shortcut 2". I assume that this can not work in this Topic yet. is it right?


#5

I don't understand .. did you pass the The n shortcut 1 ?


#6

Yes i did! I tried it on Website on the right and thought: Oh no it does not work. But then saw, that there is another Topic for the n shortcut. So it couldnt be done at that Point. So I pass the The n shorcut 2 and everything is fine. Thank you very much for your help!


#7

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