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

156
Vistas
Can I get an item value but change it by listening it?

I have a dynamic select form made with script.

When submiting with an error I want the form to stay open and save the data, but the form only opens when change is detected.

Ideally I would have the form open with "default value" but change it with listening.

$('#productType').change(function() {
  if($(this).val() == 'dvd') {
    $('#nextStep').html('<label for="size">Size (MB) </label><input type="text" id="size" name="size" value="<?php if (!empty($_POST["size"])) { echo $_POST["size"]; } else { echo ''; };  ?>" required>');
  }

  if($(this).val() == 'book') {
    $('#nextStep').html('<label for="weight">Weight (KG) </label><input type="text" id="weight" name="weight" value="<?php if (!empty($_POST["weight"])) { echo $_POST["weight"]; } else { echo ''; };  ?>" required>');
  }

  if($(this).val() == 'furniture'){
    $('#nextStep').html('<label for="height">Height (CM) </label><input type="text" id="height" name="height" value="<?php if (!empty($_POST["height"])) { echo $_POST["height"]; } else { echo ''; };  ?>" required><br><br><label for="width">Width (CM) </label><input type="text" id="width" name="width" value="<?php if (!empty($_POST["width"])) { echo $_POST["width"]; } else { echo ''; };  ?>" required><br><br><label for="lenght">Lenght (CM) </label><input type="text" id="lenght" name="lenght" value="<?php if (!empty($_POST["lenght"])) { echo $_POST["lenght"]; } else { echo ''; };  ?>" required>');
  }
});
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