I have the form below which when I click on Add More Pets , it includes perfectly. So far it's working 100%, see:
PleasenotethatIhaveanumberingnexttothetitle#1.Iwouldlikeasnewpanelstobeincluded,benumbered:#1,#2,#3,#N...
Itriedthefollowing:
HTML
<divclass="panel-heading">
<span id="contar">#1</span> <i class="fa fa-paw fa-lg" aria-hidden="true"></i> DADOS DO PET
</div>
JQUERY
$(".adicionarCampo").click(function() {
novoCampo = $("tr.linhas:first").clone();
novoCampo.find('input[type="text"]').val("");
novoCampo.find('select').val("");
if ($("tr.linhas").length < 20) {
for(i = 0; i < $("tr.linhas").length; i++){
contar = i + 2;
$("#contar").append(contar);
}
novoCampo.insertAfter("tr.linhas:last");
}
});
But it numbers only in the first panel, see below when I include one more field, that is, total of 02 fields: