在按下添加按钮之前,它已经显示了一行,其中包含三个输入框和一个删除按钮,当我add
按下按钮时,它添加了一行现在我有两行,当我按下添加按钮时,second time
它显示4 rows
,按下后third time
它显示8 rows
我的代码:
<div class="row">
<div class="col-12">
<h3>Add Video</h3>
<form id="insertvideo" method="post">
<table id="addrow" width="100%">
<td><input type="button" class="btn btn-success addButton col-3 offset-1" value="add"/></td>
<tr class="clonetr">
<td>Video Title<input type="text" id="videotitle" name="videotitle[]" class="form-control"></td>
<td>Video description<input type="text" id="videodesc" name="videodesc[]" class="form-control"></td>
<td>Video Links<input type="text" id="videolink" name="videolink[]" class="form-control"></td>
<td><input type="button" class="btn btn-danger deleteButton" value="delete"/></td>
</tr>
</table>
</form>
</div>
</div>
<script>
$(function(){
$(".addButton").click(function(){
$('.clonetr').closest("tr").clone(true).appendTo("#addrow");
});
$(".deleteButton").click(function(){
$(this).closest("tr").remove();
});
});
</script>
add按下按钮后,我只想添加一行。
慕容708150
当年话下
慕仙森