I know there are already threads on this but I couldn't find an answer to fit my needs. I'm trying to use external JS to change external CSS. I have a very simple CSS body style:
html, body{
background-color: black;
color: white;
}
To change this with JavaScript I tried:
var bg = document.getElementById("body");
body.style.backgroundColor = white;
But that didn't seem to work. I don't have too much experience with CSS combined with JavaScript so I think the fix is something simple but I can't seem to find an answer. Any help would be appreciated.
white
, and javascript takes it as variable, it should be a string. eg.'white'
.