9 .The n shortcut 2 , is my code wrong

#1

this is the error message , It is returning

Oops, try again. It looks like the n key isn't moving to the next article. Remember to remove the 'current' class from currentArticle and place it on nextArticle.

``````var main = function(){
\$('article').click(function(){
\$('.article').removeClass();
\$('.description').hide();

\$(this).children('.description').show();

});
\$(document).keypress(function(event){
if(event.which === 111){
\$('.current').children('.description').toggle();
}else if(event.which === 110) {
var currentArticle = \$('current');
var nextArticle = currentArticle.next();

currentArticle.removeClass('current');
}
});
}

.``````

#2

it is ok now , I forgot to add a point before current ,

``````var currentArticle = \$('current');    \\ wrong
var currentArticle = \$('.current');    \\ right``````

but I am wondering myself why we don't add point or dot in next "current " lines

``````      currentArticle.removeClass('current');

#3

why we don't add point or dot in next "current " lines

This should explain that for you:

#4

Thank you so much Zystran

#5

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