Help with O key


#1

I cant to get right can someone tell me what i am doing wrong ??
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();
}
});
};



...

...

#2

Please post a link to the exercise page. Thanks.


#3

I think there's a problem with the validation tool on that page. Even if you C&P the suggested code it still gives an error. I found the code functions perfectly, just that the validation fails. Just ignore it and change the page number in the URL to step 8 and keep going I'd say.


#4

in the if statement we see .children('description') this is wrong as the description is already the child element of the document therefore the code should be:

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


#5

Thank you, that was the only thing that helped me!


#6

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