Javascript File Input Onchange Isn't Triggered When They Select A File With The Same Name
I have a file input in my webpage that allows a user to upload images. I have things set up so that when they select an image, the change event of the file input is triggered and i
Solution 1:
A simple solution is to do the following:
this.input.addEventListener('click', function() {
this.value = '';
}, false);
This causes the change event to be triggered any time the user selects a file, because the initial click that opens the file browsing popup clears the input.
Solution 2:
this.input.bind('click', function() {
this.value = '';
}, false);
instead of deprecated .addEventListener()
try .bind()
Post a Comment for "Javascript File Input Onchange Isn't Triggered When They Select A File With The Same Name"