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