snipplets.dev/~/JavaScript/addClass.js
2022-04-03 09:04:24 +03:00

6 lines
170 B
JavaScript

// Use element.classList.add to add a class:
element.classList.add('my-class');
// And element.classList.remove to remove a class:
element.classList.remove('my-class');