Why removeClass('current') not removeClass('.current')?


#1

Hey guys, I have a technical question that I'm getting myself confused on. I'm on exercise 9 (The N Shortcut 2) and I got confused on why $('.current') uses a dot in the beginning and removeClass('.current') doesn't. Can anyone explain this?

else if (event.which === 110) {
            var currentArticle = $('.current');
            var nextArticle = currentArticle.next();

            currentArticle.removeClass('current');
            nextArticle.addClass('current');

#2

Hi Ivanakbar,

This FAQ post should explain that for you :slight_smile:

Let me know if you still have questions!


#3

I have the same code, but they said: "Oops, try again. Make sure you have defined all the variables!" why? Can anybody explain it? Thanks


#4

Hi Ivanakbar,

This FAQ post should answer your question :slight_smile:


- [FAQ] Common Problems for “Make an Interactive Website: News Reader”