[eluser]Chris Newton[/eluser]
Code:
var preset_0= new Array();
preset_0[0]='Field 1';
preset_0[1]='Field 2';
preset_0[2]='Field 3';
var preset_1= new Array();
preset_1[0]='Field 1b';
preset_1[1]='Field 2b';
preset_1[2]='Field 3b';
$(document).ready(function() {
$("#presets").change(function() {
// Choose array based on drop down value (preset_1)
// For each array value, fill an input field named like 'input_1' 'input_2', 'input_3', 'input_xx... so on'
});
});
//]]>
Need a little jQuery help, if anyone out there would be so kind.
When I make a selection (change) to #preset (which is a drop down with values like 'preset_0 => "Choice 1"') I'd like to fill input fields with the associated array data. With PHP, I'd just use a foreach loop, but I'm not good enough with jQuery to figure out how to do the same.
For each array item, I'd like to fill an input field with the same key (input_field_0, input_field_1, input_field_2) from the selected array.
Is that clear? Am I talkin crazy talk? If I was just going to update 1 field, I know how to do that, just can't figure out the rest.