Code
window.onload = function() {
var refButton = document.getElementById("old");
refButton.onmouseover = function() {
refButton.className = 'newClass';
}
};
.newClass {
color: white;
}
#old {
color: blue;
}
<div id="old">
Hello
</div>
If instead of ClassName I type style.color="red" then the code works.
I wonder what the problem is.
#oldrule is overwriting the color, hence it stays blue.