Javascript Array in for loop returns undefined
<p>When I loop this array with a for loop it somehow gives me undefined in </p>

<pre><code>updateField(this.value, vehicles[i]+"_brand"
</code></pre>

<p>While </p>

<pre><code>$("#"+vehicles[i]+"_year").change(function(){
</code></pre>

<p>Does get the right values of the array. How can this be and how can I solve this?</p>

<pre><code>var vehicles = new Array();
    vehicles[0] = "auto";
    vehicles[1] = "truck";
    vehicles[2] = "motor";

for(var i = 0;i &lt; 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');
    });
}
</code></pre>
