'Having trouble changing classes to diferent tags of html with js and css

I was trying to do the same thing to body but for other tags like button, fieldset, etc

The way to change the body tag for darkmode is "document.body.classList.add("darkmode");" but i need to know the same thing but for other tags like the ones i named before.

My JS code

let darkMode = localStorage.getItem("darkMode");

const enableDarkMode = () => {
    document.body.classList.add("darkmode");
    localStorage.setItem("darkMode", "enable");
}

const disableDarkMode = () => {
    document.body.classList.remove("darkmode");
    localStorage.setItem("darkMode", null);
}

if(darkMode === "enable"){
    enableDarkMode()
}

$("#dark_mode_toggle").click(() => { 
    darkMode = localStorage.getItem("darkMode");
    if (darkMode !== "enable"){
        enableDarkMode();
    }else{
        disableDarkMode();
    }
});


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source