+ 2
How can I make it true??
4 Answers
+ 7
Toni's change works or single line:
document.body.style.backgroundColor = document.getElementById("color").value;
+ 3
The body in your CSS file is not defined.
Try this for example
body
{
background-color: blue;
}
+ 2
Your body is not defined in javascript.
function a(){
var body = document.getElementsByTagName("body")[0];
body.style.backgroundColor = document.getElementById("color").value;
}
document.getElementById("btn").addEventListener("click" , a)
0
thank you