As the name suggests it returns a list of all the classes of an element. For example
With the list comes a very nice list of API methods. Most interesting of them are
- add() - adds a classs
- remove() - removes a class
- contains() - returns if a class exists
- toggle() - toggles a class (good for adding/removing hidden class)
Well, that’s just to introduce the API and for me to check in case it doesn’t catch up and I forget about it. Its a pretty simple API but makes life way easier if you’re using plain JS.