In my page in PHP and Javascript, I created a space that contains two Textboxes and a clickable label to add more Textbox, if necessary, to the numPart div:
<div id="numPart">
<div class="inputMGM"><input name="part" id="" class="validate[required]"></input></div>
<div class="inputMGM"><input name="part" id="" class="validate[required]"></input></div>
</div>
<label id="addPart" class="SpaceEnviar" style="cursor: pointer; decoration: underline">ADICIONAR PARTICIPANTE</label>
And the function that adds more textbox is as follows.
var x=1;
$("#addPart").click(function(){
var d = document.getElementById('numPart');
d.innerHTML += "<div class='inputMGM'><input name='part' id='' class='validate[required]'></input></div>";
});
However, if I have filled in one of the existing Textboxes and clicked to add one more, the existing text that I filled in disappears.
How can I do to keep the texts written in the existing Textbox as I click to add more to the form?