7
I’m using the plugin jQuery Cloneya
to clone elements of a form with jQuery, but it is a little limited, wanted to clone the inputs
but I need to increment the name when this is done, for example:
<input type="text" name="produtos[qtd][1]">
The next input
cloned would have to have the name produtos[qtd][2]
, if there is a way to do this with this plugin or otherwise, the consequence of cloning the inputs
so is that the validation plugin only validates the first input
(jquery.validate
).
This is an example of how is my form
<form method="post">
<div class="wrapper">
<div class="toclone">
<select name="list">
<option>selecione...</option>
<option>opção 1</option>
<option>opção 2</option>
<option>opção 3</option>
<option>opção 4</option>
</select>
<input type="text" name="produtos[qtd][]">
<button type="button" id="add">+</button>
<button type="button" id="remove">-</button>
</div>
</div>
<input type="submit">
</form>
To clone an element in js: http://answall.com/q/4321/3082
– Paulo Roberto Rosa
the plugin requires only the startup command, which is what is described in the documentation. Other than that, I couldn’t find anything there to help solve the problem of increasing the Names
– Leandro RR