I want to fire an event when the user select a file. Doing so with .change
event it works if the user changes the file every time.
But I want to fire the event if the user select the same file again.
A.jpg
(event fires)B.jpg
(event fires)B.jpg
(event doesn't fire, I want it to fire)How can I do it?
You can trick it. Remove the file element and add it in the same place on change
event. It will erase the file path making it changeable every time.
Or you can simply use .prop("value", "")
, see this example on jsFiddle.
prop
attr