I have this form:
<form ...>
<select name="fuits[]" id="fruits[]">
<option value="A">Apple</option>
<option value="O">Orange</option>
<option value="P">Pear</option>
</select>
<input type="text" name="fruit[]" id="fruit[]" />
<select name="fruits[]" id="fruits[]">
<option value="A">Apple</option>
<option value="O">Orange</option>
<option value="P">Pear</option>
</select>
<input type="text" name="fruit[]" id="fruit[]" />
<select name="fruits[]" id="fruits[]">
<option value="A">Apple</option>
<option value="O">Orange</option>
<option value="P">Pear</option>
</select>
<input type="text" name="fruit[]" id="fruit[]" />
...
<input type="submit" value="send" />
So, I need fill each input text from each select option values (match input text with the selected option)
I have this JQuery, but it doesn't work fine =(,
$("select[name='type[]']").change(function() {
$("input[name='tvalue[]']").eq($(this).index()).val(this.value);
}).change();
Here is the DEMO (thanks to karim79): http://jsfiddle.net/GKrd9/4/ suggestions please?
Thanks! Carlos