我已经创建了输入字段,但是当我点击前两个,它做得很好,直到当我请求第三个来自前两个和还有其他的也可以。可以请一些帮助我。 这里是我的javascript代码:我怎样才能使这个动态输入字段下降,而不是在别人的中间
$(document).ready(function() {
// it to after "after-add-more" div class.
$(".add-more").click(function() {
var html = $(".copy-fields").html();
$(".after-add-more").after(html);
});
$("body").on("click", ".remove", function() {
$(this).parents(".control-group").remove();
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
<div class="panel-body">
<div class="input-group control-groups after-add-more-inputs">
<input type="text" name="addmore[]" class="form-control" style="width:30%;">
<input type="text" name="addmore[]" class="form-control" style="width:30%;">
<input type="text" name="addmore[]" class="form-control" style="width:30%;">
</div>
<br />
<div class="add-more-inputs">
<a href="#">Add</a>
</div>
<!-- Copy Fields -->
<div class="copy-field hide">
<div class="control-groups input-group" style="margin-top:10px">
<input type="text" name="addmore[]" class="form-control" style="width:30%;">
<input type="text" name="addmore[]" class="form-control" style="width:30%;">
<input type="text" name="addmore[]" class="form-control" style="width:30%;">
<div class="remove">
<a href="#"> Remove</a>
</div>
</div>
</div>
</div>
我真的很想理解你的问题。 – FosterZ
你的意思是**你怎么能在最后一行之后添加新的输入集/行?** –
check:class =“add-more-inputs”和“.after-add-more” –