The n shortcut 2


#1



I couldn't complete this exercise /.I'm getting error message .what's wrong in my code .please help me .


 var main = function() {

$('.article').click(function(){
$(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');
nextArticle.addClass('current');
}
$('.article').children('.description').toggle();
}
};
$(document).ready(main);


#2

Hi Radheshyam,

Please post a link to the exercise you're on and the error message you're getting so we can help you :slight_smile:

In the meantime, try these two things:

  1. Use indentation. Proper whitespace makes finding problems in your code much easier.
  2. Add a closing parenthesis ()) after your closing curly brace on the third to last line to close your $(document).keypress(...); part

#3

https://www.codecademy.com/courses/web-beginner-en-4hxyb/0/9?content_from=make-an-interactive-website%3Ajquery-events
I Stucked in this exercise .and

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.
This is the Error message i'm getting.


#4

Thanks to zystvan ..In other page I got the solution.


#5

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