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

92
Views
Cloning input fields does not clone new forms as blanks

I am trying to implement the tried and tested method of creating unlimited input fields (replicated below) . My problem is when i click the button to add new fields, the inputs in the already filled input elements carryover to the new form instead of being cloned as blanks. Screenshot of the form

`function moreFields() {
 let counter = 0;
    counter ++;
    let newFields = document.getElementById('readroot').cloneNode(true);
    newFields.id = '';
    newFields.style.display = 'block';
    let newField = newFields.childNodes;
    for (let i=0;i<newField.length;i++) {
        let theName = newField[i].name
        if (theName)
            newField[i].name = theName + counter;
    }
    let insertHere = document.getElementById('writeroot');
    insertHere.parentNode.insertBefore(newFields,insertHere);
  
  console.log("more fields worked")
}`

Is there any way to fix this. Thanks

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!