I made a page where the user could change the page's body/header/footer's background color by inputting the color into a textbox. My functions are:
function changebody(){
let color = document.getElementById("bodycolor").value;
document.body.style.backgroundColor = color;
}
function changenav(){
let color = document.getElementById("navcolor").value;
document.getElementsByTagName("nav").style.backgroundColor=color;
}
function changefoot(){
let color = document.getElementById("footcolor").value;
document.getElementsByTagName("footer").style.backgroundColor = color;
}
The function for the body works fine but i can't seem to get the function for footer and nav bar to work. Any suggestions why? (I've already checked to see if i got the right id's.)
edit: thank u for the comments!! it works now :D