i'm in big urge. The task may be simple, but not for me :)
I have a task to make color selection with color picker, then choose radio buttons of header or footer and submit button. I have already searched whole internet and have no answer how to write correct JS to make it work... HELP!
HTML -
<div class="colors" id="co">
<label for="spp">Choose color:</label>
<input type="color"/><br>
<input name="CC" type="radio" id="header" value="0"/>Header<br>
<input name="CC" type="radio" id="footer" value="1"/>Footer<br>
<button onclick="return changeColor();">Change</button>
</div>
JavaScript -
function changeColor() {
var radio = document.documentElement["sp"];
for (var i = 0; i < radio.length; i++) {
if (radio[i].checked == true) {
var newColor = radio[i].value;
document.getElementById("changeColor").style.backgroundColor = newColor;
return false;
}
}
}
Thank you in advance! :)