我想在我的网络表单中动态创建一个输入类型的文本。更具体地说,我有一个文本字段,用户可以在其中输入所需文本字段的数量;我希望以相同的形式动态生成文本字段。
我该怎么做?
最佳答案
使用 JavaScript:
var input = document.createElement("input");
input.type = "text";
input.className = "css-class-name"; // set the CSS class
container.appendChild(input); // put it into the DOM
关于javascript - 如何动态创建<input type =“text”/>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5656392/