使用Javascript或AJAX动态添加输入框
我有一列输入框,最后一行有一个按钮,可以在最后一个输入框下面添加更多的输入框。有什么最好的办法吗?你可以这样做:使用Javascript或AJAX动态添加输入框,javascript,Javascript,我有一列输入框,最后一行有一个按钮,可以在最后一个输入框下面添加更多的输入框。有什么最好的办法吗?你可以这样做: function addTextBox() { var container = document.getElementById('container'); var txt = document.createElement('input'); txt.type = 'text'; txt.name = "my name"; container.appendChil
function addTextBox()
{
var container = document.getElementById('container');
var txt = document.createElement('input');
txt.type = 'text';
txt.name = "my name";
container.appendChild(txt);
}
在上面的代码中,
container
应该是包含文本框的列id。您使用的是jQuery,还是只使用普通JavaScript?