how to put an individual id on an image preview before uploading multiple files using jquery?

You are not declaring your loop variable (i) and so it is implicitly becoming a Global and it is not providing loop iteration scope so you have a closure around i.

Change the declaration to use let to declare the loop counter, which gives block level scope and each iteration will have its own scope to store the counter in.

 for (let i = 0; i < filesAmount; i++) {

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top