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

87
Vistas
Html set text color to colorwheel

I'm wondering how I can set the color of this text:

<p style="font-size: 30px; color: #222;" class="txt>Text example</p>

to the value selected on this color wheel:

<input type="color" value="#f6f82" id="colorPicker">

If the value of the color wheel changes, the text should adjust so the color is set to the value of the color wheel, how can this be done?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

It's just a matter of updating the style of text onchange of input.

add onchange attribute to the input field which can call a JavaScript method.

Define the JS method to get the value from input and set the text style.

const setTextColor = (value) => {
    document.querySelector('.txt').style.color = value;
};
<input type="color" value="#f6f82" id="colorPicker" onchange=setTextColor(value)>
<p style="font-size: 30px; color: #222;" class="txt">Text example</p>

about 4 years ago · Juan Pablo Isaza Denunciar
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