I'm using the next JavaScript and Jquery code for to insert inputs in the html DOM:
function insertInput(elemento) {
$(elemento).html("<input type='text' id='"+elemento.slice(1)+"' name='"+elemento.slice(1)+"'>")
}
the parameter elemento is an id and name for the input to be generated, and the form I used is the following:
<form method="get">
<div id="inputs">
... input insertion
</div>
<button type="submit">Aceptar</button>
</form>
and the above code, generates this
<form method="get">
<div id="inputs">
//example id and name
<input type="text" id="calorias1" name="calorias1">
</div>
<button type="submit">Aceptar</button>
</form>
So far, everything works as it should, but, when I press the submit button, the url must be de following:
index.html?calorias1=anyvalue
instead of that:
index.html?
I don't know why that happens