I hvae input file like:
<input type="text" id="txtPath" placeholder="No file selected" />
<input id="btnBrowse" type="button" value="Browse..." onclick="document.getElementById('file').click();" />
<input type="file" id="loadFile" style="display:none;" id="file" name="file" />
And I want to alert the selected path, I tried like:
document.getElementById("loadFile").addEventListener("change", function(event) {
let output = document.getElementById("txtPath");
let files = event.target.files;
alert(files);
},false);
But this doesn't work, the error:
Cannot read property 'click' of null