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

113
Vistas
jquery code under hidden input field is not work when we get it using jquery

I have added the field and their jquery code to get the value for that field like

<input type='hidden' name="test" id="test" value="data=$('#response').val()">

I am getting that hidden field value in jquery and splitting it by '=' but when I alert the value it shows the $('#response').val() i am expecting it to return the value of the response field type.

var val = $("#test").val();
var arr1 = val.split('=');

alert(arr1[1]);

return => $('#response').val()

expected => value of responce field.

please let me know what i am doing wrong.

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

0

in the value attribute there will be no javascript executed, it just contains the value of the input, see https://www.w3schools.com/tags/att_value.asp or compare to onclick attribute for example. There might be some parsing with alert, but it´s general knowledge not to debug any js with alerts.

you can just set the value attribute with javascript though

below your relevant markup you could do:

$('#test').val( $('#response').val() ); // will set the value

var expected = $('#test').val(); // will output the desired value then
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