12th Feb 2018, 10:02 PM
Sina
Sina - avatar
4 Answers
+ 7
Toni's change works or single line: document.body.style.backgroundColor = document.getElementById("color").value;
12th Feb 2018, 11:08 PM
John Wells
John Wells - avatar
+ 3
The body in your CSS file is not defined. Try this for example body { background-color: blue; }
12th Feb 2018, 10:08 PM
SQL Guy
+ 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)
12th Feb 2018, 10:15 PM
Toni Isotalo
Toni Isotalo - avatar
0
thank you
13th Feb 2018, 11:28 AM
Sina
Sina - avatar