<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
</head>
<form method="post" action="../admin/A_Office/publish_newsletter">
<div id="list" class="input_more_target">
<label for="email">Email</label>
<div class="form-group">
<input class="form-control" name="email[]" type="email" value="">
</div>
<input type="button" value="Add more" class="add_field_button btn btn-primary">
</div>
<input type="submit" value="Publish" class="btn btn-primary">
</form>
此脚本添加/删除新输入字段:
<script type="text/javascript">
$(document).ready(function() {
var wrapper = $(".input_more_target");
var add_button = $(".add_field_button");
$(add_button).click(function(){
$(wrapper).append('<label for="email">Email</label><div class="form-group"><input class="form-control" name="email[]" required type="email" value=""></div><input type="button" class="remove_field btn btn-primary" value="Remove">')
});
$(wrapper).on("click",".remove_field", function(e){
e.preventDefault(); $(this).parent('div').remove(); x--;
})
});
</script>
我的问题是:
如果你能引起我的注意,那就太好了!谢谢!
答案 0 :(得分:0)
好的,我找到了; 表格在外部div中打开,所以我没有收到任何数据