I don't understand something


#1

I don't understand why we first access the selector '.active-dot' and then use .removeClass to remove 'active-dot' class. Similarily, why do we access '.active-slide' and then remove 'active-slide' class? Aren't we supposed to access classes by . and Ids by # in jQuery?


#2

The removeClass methods know that you'll be working with classes/ids, so you don't need the . or #.


#3

The programs don't work if I don't put .
They sometimes don't work when I put it.
I am confused by the instructions. Sometimes they say to use ., sometimes they don't.

(From Get a Hint)
$('.arrow-prev').click(function() {
var currentSlide = $('.active-slide');
var prevSlide = currentSlide.prev();

var currentDot = $('.active-dot');
var prevDot = currentDot.prev();

if(prevSlide.length === 0) {
prevSlide = $('.slide').last();
}

currentSlide.fadeOut(600).removeClass('active-slide');
prevSlide.fadeIn(600).addClass('active-slide');

currentDot.removeClass('active-dot');
prevDot.addClass('active-dot');


#4

You don't need them in removeClass or addClass as I said,

You need them otherwise.