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