I\'m playing with JavaScript and wrote simple function that creates INPUT
element (type=\"file\"
) and simulates click.
var createAn
Event listener input.addEventListener ("change" ...
is not getting registered immediately. It's like wrapping code in setTimeout(fn, 0)
which makes it added to the end of the execution queue.
But input.click(); opens a file selection popup instantly which pauses JavaScript(so the event won't register until the popup is closed). If you wrap input.click in setTimeout(function() { input.click(); }, 0)
then it will definitely be executed after the event is registered and this theory may be correct.
I can't reproduce your problem so this is just pure theory.