# classList

*noun*

say it: **“KLAS-list”** **/ˈklæslɪst/**

An element's CSS classes, with methods to add, remove and toggle them.

## What is **classList** in JavaScript?

**classList** — An element's CSS classes, with methods to `add`, `remove`, `toggle` and check (`contains`) them one at a time. Changing a class lets the stylesheet do the styling, instead of setting styles in JavaScript.

```javascript
const button = document.querySelector("#favorite");
button.classList.toggle("active");
```

## In a sentence

- “Clicking the star calls **classList**.toggle("active") to color it in.”

Level: Apprentice · [More JavaScript terms at this level](https://www.ask-codey.com/glossary?category=javascript&level=2)

Updated: October 28, 2026

Source: https://www.ask-codey.com/glossary/classlist
