Skip to content
Advertisement

input file event onchange no work when button click input file

I fire input file via JS function like this:

JavaScript

This control have a onchange event to validate the file:

JavaScript

Event is firing correctly but when I get the input file by Id not contains the file:

JavaScript

If I do the same via input file (changing style=”display:none”) is working as expected.

How I can resolve this problem? What I did wrong?

Thanks!

Advertisement

Answer

You could use the onchange event’s parameter to access the files object on change

JavaScript
JavaScript
JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement