When you write $(...).change(function) , you add a handler to the elements that are currently in the jQuery object. When you add a new <input> , it has no event handlers.
You need to call .live , which will handle the event for all relevant elements no matter when they were created.
For instance:
$('input:file:last').live('change', function() { ... });
Note that the selector is evaluated only once, so it will not receive changes in i .
Instead, you should use :last .
source share