I am trying to create an anonymous function for onchange event of file field, so that when a file is selected, the covering text field gets that value. I know how to accomplish this by adding onchange="", but I'd prefer not do that. The code that I have almost works, except that the function in the for loop can't call on the "i" variable that the loop uses.
for( i = 0; i < source.length; i++) {
source[i].onchange = function() {
name[i].value = this.value;
}
}