Posts

Showing posts from December 24, 2018

create input text with loop js

Image
0 I would like to know how could I create many <input type=text /> tags with a loop in JS. I need that loop to be linked to a first input ( type=number ), which tell to the loops how many input text to create. function getP () var nbP = Number(document.getElementById("nombreP").value); for (var i = 0; i < nbP; i++) var newForm = document.createElement("input[type=text]"); newForm.id = "form"+i document.body.appendChild(newForm); <form method="get"> <input type="number" name="nombrePlat" id="nombreP"> <input type="submit" value="Envoyer" id="ok" onclick="getP()"> </form> javascript html share | improve this question edited Nov 11 at 12:45 Foo 1 asked Nov 11 at 11:46 KhroNoSS 3 3 No need to say sorry! Everyone has to learn at one point. What exactly do you want to do with t...