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

190
Vistas
I would like to launch my function when the user types text in the fields

I get the 4 inputs of my form :

let fielsForUppercase = document.querySelectorAll(".uppperFirstLetter");

My function works correctly when I test :

fielsForUppercase[0].value = 'test 1';
fielsForUppercase[1].value = 'test 2';
fielsForUppercase[2].value = 'test 3';
fielsForUppercase[3].value = 'test 4';
function CapitalizeFirstLetter() {
    for (let y = 0; y < fielsForUppercase.length; y++) {
        console.log(fielsForUppercase[y].value.charAt(0).toUpperCase() + fielsForUppercase[y].value.slice(1));
    }
}
CapitalizeFirstLetter();

But I would like to run this function when the user types in the input, I tried this, but it doesn't work :

for (let i = 0; i < fielsForUppercase.length; i++) {
    fielsForUppercase[i].addEventListener("change", CapitalizeFirstLetter);
}
about 4 years ago · Juan Pablo Isaza
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