When I loop this array with a for loop it somehow gives me undefined in
updateField(this.value, vehicles[i]+"_brand"
While
$("#"+vehicles[i]+"_year").change(function(){
Does get the right values of the array. How can this be and how can I solve this?
var vehicles = new Array();
vehicles[0] = "auto";
vehicles[1] = "truck";
vehicles[2] = "motor";
for(var i = 0;i < vehicles.length;i++){
$("#"+vehicles[i]+"_year").change(function(){
updateField(this.value, vehicles[i]+"_brand", 1, 2, this.parentNode.id), resetBelow(0,'auto'), show('auto_brand');
});
}