title: Get the file name after click open button in file browse dialog box using JavaScript/jQuery
body: <p>Basically I am new in web development and I'm facing a problem related to open <code>file dialog box</code> using <code>JavaScript</code> or <code>jQuery</code> my problem is that how can I open a <code>file browser dialog box</code> and after clicking <code>open</code> button in the <code>file dialog box</code> get the file <code>path</code> or <code>name</code> in <code>alert()</code> method.</p>
  
  <p><strong>I am using below code for show dialog box in JavaScript</strong></p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      function performClick(node) {
          var evt = document.createEvent("MouseEvents");
          evt.initEvent("click", true, false);
          node.dispatchEvent(evt);
          var pathnew = document.getElementById('theFile').value;
  
      }
  &lt;/script&gt;
  
  &lt;a href="#" onclick="performClick(document.getElementById('theFile'));"&gt;Open file dialog&lt;/a&gt;
  &lt;input type="file" id="theFile" /&gt;
  </code></pre>
  
  <p>above code shows perfectly file browse dialog box but this alert box show when I click on 
  <code>Open file dialog</code> but I need after clicking Open button which is under the File browse dialog box. 
  Please Help me!</p>
  
  <p>Any help will be appropriated! </p>