Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

204
Visualizações
How to change header and footer color by selecting color picker and radio button?

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! :)

about 4 years ago · Santiago Trujillo
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda