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
Putting a variable into a form using plain Javascript

This is pretty plain and simple but I'm just scratching my head. I created a form (https://taa.be.wolterskluwer.com/l/940253/2021-10-08/5tgp6n) which contains a field GACLIENTID (I've assigned it the classes GA_Client_ID & GACLIENTID) however since the form is not handcoded the class is assigned to the contacting paragraph (which contains a label & input).

I've successfully pushed my variable using the following script:

<script>
  (function() {
    var list = document.querySelectorAll('input[name="940253_168501pi_940253_168501"]');
    list.forEach(function(el){
      if(el) {
        el.value = {{DL - GA Client ID}};
  }
})
  })();
</script>

But this finds the input with the "name" of the field which changes on every clone of the form I'm creating. So I'm looking for a more "universal" way of selecting the input within the class but I just can't, for the life of me, figure out the correct syntax.

Any help is much appreciated.

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

0

var list = document.querySelectorAll('.GACLIENTID input');
about 4 years ago · Juan Pablo Isaza Denunciar

0

If there's only ever one matching field.

const input = document.querySelector('.GACLIENTID input');

if (input) {
    input.value = {{DL - GA Client ID}};
}
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