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

88
Vistas
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
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