Reputation: 1159
After some simplifications, code looks like this
$(function(){
var x = $("<input type='file'>");
$(document.body).append(x);
x.trigger("click");
});
After page loads, nothing happens, but when I open console and call trigger("click") on it, it opens dialog as it should. What's the reason of first time event ignoring?
Use chrome Version 52.0.2743.116 (64-bit)
Upvotes: 0
Views: 196
Reputation: 13
Hi this trick only works on IExplorer. Input file can't be automatically triggered in (onload, pageload, document.ready...) due to security purpose
Upvotes: 0