I have following html and javascript codes.
<input type="file" id="file" onchange="run()">
function run() { alert(document.getElementById("file").value); }
Here, when user clicks the "browse" button and selects a file, the javascript alerts out the file selected by the user. The issue is, after selecting a file when the user again clicks the "browse" button but clicks the cancel now without making any selection, the javascript code alerts nothing. I mean even though user cancels the window the javascript should still be alerting out the previously selected file.
And I get this issue only on chrome, not in firefox or IE. The code is very basic so the code is not the problem i guess. I think it is a cross browser problem. Any idea ? Thanks in advance.
Aucun commentaire:
Enregistrer un commentaire