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

144
Views
fill iframe input field on button click, filled in fields deleted if manually interact/fill in other input fields, submit data marks fields as empty

I'm trying to create a visual questionare that works in a way that if a user clicks on a button, that button's data attribute is taken and filled in into the iframe's fields. However, if you try to manually add in any additional info or interact in any way with the iframe, it removes all the auto-filled info.

Also if you try to submit the info it says that the input fields are empty.

Kind of stuck here.

<html>
<a href="#" onclick="autofill(this)" data-filled-value="USA">United States of America</a>
</html>

<script>
function autofill(element)
{
    $("#form-iframe").contents().find("#country-field").val(element.dataset.filledValue);
    evt.preventDefault();
 
}
</script>
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!