Need help toggling the description


#1

This is my App.js code:

var main = function(){
$('article').click(function(){
$('.description').hide();
$(this).children('description').show();
$(this).addClass('current').show

});
$('.description').hide();
$('article').removeClass('current');

};

$(document).keypress(function(event){
if(event.which === 111) {
$('curent').children('.description').toggle();
}
});

$(document).ready(main);

Yet it doesnt toggle the description and I'm stuck. Can anyone elaborate on what I'm doing wrong?


#2

Hi Alexander,

Which exercise are you on?

I see a few problems, but I'm not sure if they're the cause:

  • Line 4, you need a dot (.) before description
  • Line 14 (ish), you need a dot before current, and you need to fix curent's spelling.

If that doesn't help, please give a link to the exercise you're on so I can help you better :)


#3

Hello,

Thank you for helping. Unfortunately its still not working correctly. I'm on exercise 7 "The O shortcut". Nothing seems to be working right but the lesson says I'm doing it right and no syntax errors. But when I'm supposed to test these things nothing happens, no descriptions come up or anything like that.


#4

OK, so after you do what I suggested in my answer above, you also need to fix two more things and then you should be good to go :)

  • Lines 2 and 9, you're missing a dot (.) before article
  • Line 11 needs to be moved down to line 18

Good luck with the rest of the course!


#5

Thanks so much for your help. Most of my problem was missing periods where I need them and them not being where they should be. I was able to complete the lesson after double checking spelling and the like.