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

94
Views
wrong result of the sum of the 2 fields

good evening, I've been trying since yesterday to figure out how to make my script work correctly but after several attempts it still does not work, the error is attributed to the sum that is displayed on the individual records, instead of being added, it is placed side by side. How can I correct it?

function addFields(){
            var number = document.getElementById("copie").value;
            var numeroiniziale = document.getElementById("inizio").value;
            var container = document.getElementById("container");
            var risultato = parseInt("inizio");
            while (container.hasChildNodes()) {
            container.removeChild(container.lastChild);
        }



        for (i=0;i<number;i++){
            container.appendChild(document.createElement("br"));
            container.appendChild(document.createTextNode("N° " + (i+1)));
            container.appendChild(document.createElement("br"));
            var input = document.createElement("input");
            input.type = "text";
            input.placeholder = (risultato) + (i+1);
            container.appendChild(input);
            container.appendChild(document.createElement("br"));
        }
    }
Numero iniziale:<input type="text" id="inizio" name="inizio" value=""><br /> Quanti ne genero:<input type="text" id="copie" name="copie" value=""><br />
<a href="#" id="filldetails" onclick="addFields()">Genera</a>
<div id="container"></div>

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!