snipplets.dev/code/JavaScript/addClass.js
2023-09-26 22:05:13 +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');