Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/479.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ms-access/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用javascript单击add按钮多次显示相同的表数据_Javascript - Fatal编程技术网

使用javascript单击add按钮多次显示相同的表数据

使用javascript单击add按钮多次显示相同的表数据,javascript,Javascript,如果单击“添加”按钮,我的表中有3个文本框。相同的文本框需要使用javascript附加到同一页面中。请帮助我,我的问题不清楚,但我想你想要这样的内容 function buttonClick(parent){ var test = document.createElement("input"); test.setAttribute("type", "text"); test.setAttribute("name", "someName"); parent.appendChild(test);

如果单击“添加”按钮,我的表中有3个文本框。相同的文本框需要使用javascript附加到同一页面中。请帮助我,我的问题不清楚,但我想你想要这样的内容

function buttonClick(parent){
var test = document.createElement("input");
test.setAttribute("type", "text");
test.setAttribute("name", "someName");

parent.appendChild(test);
}

使用父元素作为参数在按钮单击事件上调用此函数

请向我们提供示例代码或JSFIDLE(JSFIDLE.net).Hi anu我的问题是,我在一个页面中有3个文本框。如果我单击“添加”按钮,相同的3个文本框需要附加到同一页面中。使用javascript。将文本框放置在div或其他容器中,然后在“添加按钮单击”事件中调用此函数。做一个循环来创建3个盒子。不要害羞地问你是否仍然不能工作