HTML5 Please

classList

Safe to use with polyfillapi

The classList API adds, removes and toggles class names on an element without hand editing className strings. It is available in every current browser and has made the old class manipulation helpers unnecessary.

Verdict
Safe to use
Category
JavaScript APIs
Browser support
Can I Use
Works in
IE10+

Should you use classList in 2026?

classList is well supported nowadays, but expect incomplete support in IE10-11 and Opera Mobile (see caniuse notes).

Polyfills and fallbacks

classlist.js