javascript change an elements class code example
Example 1: Javascript change element class
document.getElementById("myElementID").classList.add('myClassName');
document.getElementById("myElementID").classList.remove('myClassName');
Example 2: html get class property
let element = document.querySelector('.preset');
let style = getComputedStyle(element);
let bg = style.backgroundColor;