I'm creating this JavaScript function, it creates a form and adds it to the body of the text in another div, but when I click the button it deletes the content that was already written in the input.
<buttononclick="addPergunta(); return false" class="btn btn-warning btnPrincipal" name="2">ABERTA <i class="glyphicon glyphicon-plus-sign"></i> </button>
<script>
var conti = 0;
function addPergunta() {
conti++;
var htmlNovo = "";
htmlNovo +=
'<div class="main-login main-center">' +
'<form class="form-horizontal" method="post" action="#">' +
'<div class="form-group">' +
'<label for="name" class="cols-sm-2 control-label">Digite sua pergunta.</label>' +
'<div class="cols-sm-10">' +
'<div class="input-group">' +
'<span class="input-group-addon"><i class="fa fa-user fa" aria-hidden="true"></i></span>' +
'<input type="text" class="form-control" name="pergunt' + conti + ' " id="name" placeholder="Qual seu nome?" />' +
'</div></div></div></form></div></div></div></div></div>' + '';
document.getElementById("multiplaescolha").innerHTML += htmlNovo;
return false;
}
</script>