title: Triggering Click Event on File Input with jQuery
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/793014/jquery-trigger-file-input">Jquery trigger file input</a>  </p>
  </blockquote>
  
  
  
  <p>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.</p>
  
  <p>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.</p>
  
  <p><a href="http://jsfiddle.net/vnS3k/" rel="nofollow noreferrer">http://jsfiddle.net/vnS3k/</a></p>
  
  <pre><code>// 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();
  });
  </code></pre>