How to add and remove CSS classes to an element using jQuery?

How to add and remove CSS classes to an element using jQuery?

Add Class
The jQuery addClass() method adds one or more classes to the selected elements.
You can also add multiple classes to the elements at a time. Just specify the space separated list of classes within the addClass() method.

Remove Class
Similarly, you can remove the classes from the elements using the jQuery removeClass() method. The removeClass() method can remove a single class, multiple classes, or all classes at once from the selected elements.

Toggle Class
The jQuery toggleClass() add or remove one or more classes from the selected elements in such a way that if the selected element already has the class, then it is removed; if an element does not have the class, then it is added i.e. toggle classes.

See examples here