Possible Duplicate:
Jquery trigger file input
I'm developing an app that needs the user to specify a file from the very beginning. I would like to have the file input box display immediately, instead of requiring the user to click an upload button.
Can someone explain to me why the third option works in my jsfiddle example while the others don't? Links to official specs would be most appreciated.
// Trigger Click Event at Load - Doesn't Work
$('#a').click();
// Trigger Click Event at Timeout - Doesn't Work
window.setTimeout(function() {
$('#a').click();
}, 3000);
// Trigger Click Event at User Click *On Something Else* - Works
$('#b').click(function() {
$('#a').click();
});