I don't get the O shortcut


#1

Here's my code:

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

$(document).ready(main);

I typed this in, but I even tried copying and pasting from the hint, but that didn't work either.


#2

HI it's because you didn't close the main function you should add one } at the end like that

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();
      }
    });
} <-- #add this one  }

$(document).ready(main);

#3

Thanks!

One of my weaknesses so far is keeping track of all the brackets. Any suggestions for how to better keep track?


#4

you can try to indent your code like that...

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

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

$(document).ready(main);

maybe like that you could find where it's missing the closing bracket


#5

did wizmarco's suggestion work for you? cuz it didnt work for me


#6

Hi if you need help you should post your code or create a new topic with your code