Im trying to clone a component , but every time i do so the cloned component doesn't work. I need this because im adding information dynamically, so if user needs he can have multiple cards with component. Below i leave the code of what im trying to achieve.
First the html im copying
<div class="card" style="display: none;" id="data0">
<form>
<div class="card-header card-header-text card-header-success">
<div class="card-text">
<h4 class="card-title">@valor</h4>
<input type="hidden" value="@valor" class="form-group" id="testeyu">
</div>
</div>
<div class="card-body">
<div class="container">
<div>
<h3>Quer colocar um label no campo?</h3>
</div>
<div class="togglebutton">
<label>
<input type="checkbox" id="placesub" onclick="checkcp(this.id)">
Não
<span class="toggle"></span>
Sim
</label>
</div>
</div>
<div class="form-group">
<!-- <form> -->
<div class="form-group" id="labelcamp" style="display: none;">
<h4 class="title">Label/Identificador</h4>
<input type="text" class="form-control" id="labelreq" aria-describedby="emailHelp" placeholder="Insira o label do seu campo">
<small id="emailHelp" class="form-text text-muted">O label irá aparecer antes do conteudo/campo do seu valor</small>
</div>
<div class="form-group">
<h4 class="title">Escolha a sua data</h4>
<div class="form-group">
<EjsCalendar TValue="DateTime"></EjsCalendar>
</div>
</div>
<div class="space-10"></div>
<div class="form-group">
<button id=@acremove type="button" class="btn btn-danger btn-sm btn-round" onclick="removeElement(this.id)">
<i class="material-icons">remove_circle_outline</i> Remover campo
</button>
</div>
<div class="space-10"></div>
</div>
</div>
</form>
</div>
Javascript/Jquery that use to clone element;
var row = $("#data0");
var table = document.getElementById("colar"); // find table to append to...... a dar append/colar
var clone = row.clone(true,true).prop('id', count).prop('style', "");
clone.find("#placesub").attr("id", "checkbox" + count);
clone.find("#labelcamp").attr("id", "label" + count);
clone.find("#labelreq").attr("id", "lareq" + count);
clone.find("#cenas").attr("id", "cenas" + count);
count++;
clone.appendTo(table);