Simple friend, taking a look at the link you made available I noticed that you made a:
let container = document.getElementById('people-container');
let div = document.createElement('div');
div.innerHTML = template;
container.appendChild(div);
The idea is right, what’s wrong is where the div people-container
meets. you are adding form-row
within a form-row
, the solution to your problem is to put the div with id people-container
out of the div form-row
. I will share the code with your edited structure.
<body>
<div class="container">
<div class="row">
<div class="col-12" id="form">
<form action="" method="post">
<div class="form-row">
<div class="form-group col-md-12">
<blockquote class="blockquote text-center">
<h1>Nome_Projeto</h1>
<p><em>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Molestias, velit.</em></p>
</blockquote>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label for="NomeDE">Nome Data Exntesion:</label>
<input type="text" class="form-control" id="NomeDE" placeholder="Nome Data Extension..." name="NomeDE" required>
</div>
<div class="form-group col-md-6">
<label for="ExternalKey">External Key:</label>
<input type="text" class="form-control" id="ExternalKey" placeholder="External Key..." name="ExternalKey" required>
</div>
</div>
<div class="form-row" >
<div class="form-group col-md-6">
<label for="NomeCampo">Nome Campo:</label>
<input type="text" class="form-control" id="NomeCampo" placeholder="Nome Campo..." name="NomeCampo[1]">
</div>
<div class="form-group col-md-3">
<label for="TipoCampo">Tipo:</label>
<select class="form-control" id="TipoCampo" name="TipoCampo[1]">
<option>Text</option>
<option>Number</option>
<option>Date</option>
<option>Boolean</option>
<option>EmailAddress</option>
<option>Phone</option>
<option>Decimal</option>
<option>Locale</option>
</select>
</div>
<div class="form-group col-md-3">
<label for="StatusCampo">Status:</label>
<select class="form-control" id="StatusCampo" name="StatusCampo[1]">
<option>Primary Key</option>
<option>Nullable</option>
</select>
</div>
</div>
<div id="people-container"></div> // coloquei a div aqui, fora da div form-row
<br><br>
<div class="form-group col-md-12 text-center">
<a href="javascript:;" id="add-new-person" class="add-new-person">+ Campo</a>
</div>
</form>
</div>
</div>
</div>
<script src="js/add.js"></script>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
Good studies Jeferson. Check the code working here.
Man thank you so much yesterday I was trying a lot of things and I hadn’t gotten into it!
– J.SILVA
How great was I able to help you Jeferson, could you mark my answer as the right one ? Just click on the right icon on the side of my answer :) .
– RickPariz
already marked brother! Thank you very much!
– J.SILVA