how to change color of a div using javascript code example
Example 1: javascript change background color
function changeBackground(color) {
document.body.style.background = color;
}
window.addEventListener("load",function() { changeBackground('red') });
Example 2: javascript change color
var span = document.getElementsByTagName("span")[0];
span.style.color = "red";