I'm using the jQuery CloneYa plugin.
to clone elements of a form with jQuery, but it is a bit limited, I wanted to clone the inputs
but I need to increment the name when 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
is that the validation plugin only validates the first input
( jquery.validate
).
This is an example of how my form is
<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>