I\'m working on a web form with a textbox for pets and an \"add pet\" button. Each time the button is clicked, an additional textbox should be displayed below the original o
Something like this?
document.getElementById("addPet").onclick = function() {
var form = document.getElementById("myForm");
var input = document.createElement("input");
input.type = "text";
var br = document.createElement("br");
form.appendChild(input);
form.appendChild(br);
}
Edit: I'd suggest using a table to style the input boxes, keep them in line. FIDDLE