0

in the submenu, when you click "Load CSV file", I want to get file type upload dialog.

here is my code but it does not open any file upload dialog.

...

<div class="subnav-content">
  <input type="file" id = "csvfile" style="display:none;" accept=".csv"/>
    <a href="#" id="loadCSV" onclick="chooseCSV()">Load CSV file</a>
    <a href="#" id="login">Login to DB</a>
    <a href="#" id="logout">Logout DB</a>
    <a href="#" id="exit">Exit</a>
</div>

JS

function chooseCSV(){
    $("#csvfile").click();
    return false;
    }

J.Kim
  • 17
  • 4
  • I am unable to reproduce this problem, your code works fine for me. Are there any errors in the console? – Snel23 Sep 18 '19 at 03:28
  • these guys already discussed your problem. https://stackoverflow.com/questions/793014/jquery-trigger-file-input – manar_mk Sep 18 '19 at 07:11

0 Answers0