Click function: why isn't the following code '.current'?


I am working on the click function section. Later on in the course we use '.current' but here it is just 'current' being called. Why is this? Something to do with removeClass() being a regular function and not the event handler?

var main = function() {


Hi Greg,

The dot (.) in front of a class name is to distinguish it from an #id or tag selector. But with addClass(), removeClass(), and toggleClass(), the dot isn't necessary because the computer knows it's dealing with a class, so no need to distinguish the different things there :slightly_smiling:

Does this help you?


Look also at leonard's post. Fully explained.
The O shortcut


Yes, thank you. Much appreciated.