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>