Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

205
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda