Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

153
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!