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

214
Vistas
Add values into hidden form fields using JS

I am trying to insert a string into the form hidden field using JS and google tag manager.

This is the script/method (worked on a bunch of different forms)

(function(){

var selector1 = $('[id="label-utm_source-f7d353cc-c056-400e-a41a-2b022eaf4340_7665"]') 
$(selector1).val('{{Read UTM Medium cookie}}');

})();

</script>

or

var selector1 = $('input name="utm_original_lead_source"') 
$(selector1).val('{{Read cookie-UTM source}}');

And nothing worked. Any idea what I'm missing here ?

Thank you!

This is the form field:

enter image description here

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

0

A css selector is actually a string. So this cannot work:

var selector1 = $('[id="label-utm_source-f7d353cc-c056-400e-a41a-2b022eaf4340_7665"]') 
$(selector1).val('{{Read UTM Medium cookie}}');

it should be something like this:

var selector1 = '*[id="label-utm_source-f7d353cc-c056-400e-a41a-2b022eaf4340_7665"]';
$(selector1).val('{{Read UTM Medium cookie}}');

This is also wrong:

var selector1 = $('input name="utm_original_lead_source"') 
$(selector1).val('{{Read cookie-UTM source}}');

And should be like this:

var selector1 = 'input[name="utm_original_lead_source"]';
$(selector1).val('{{Read cookie-UTM source}}');
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