Variable name: ".btn" vs "btn"?


When do we have to use a period in front of the variable name and when do we not have to?


.btn is used to target a btn class of your HTML element in JS(JQuery). [Remember that a class is targeted using . while an id is #].

This is an example of a btn class.

<div class="btn">


Can you explain to me why we don't use ".active-dot" for the removeClass() and addClass() but "active-dot" instead? I thought active-dot is a class in my HTML as well?

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


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