-
-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clear text on value clear #37
Comments
Maybe I should add a Thanks for the feedback @tracerx 👍 |
I'll try to work on this, just tell me where I should create the refresh method |
You can add in the Thanks @CometS1 👍 |
Not sure if my PR here fix your issue: #39 🤔 |
I'm not sure either, @tracerx could you go into more detail about your issue, and check to see if the recent PR fixes it? |
You can test that here: https://bs-custom-file-input.netlify.com/ 👍 |
That PR wouldn't fix this issue because changing the value in the JS won't fire the change event. As you suggested, a refresh method for the control would be needed. form.reset works but not if you just want to change the value of that control without resetting the rest of the form. |
Maybe before the PR of @CometS1, @tracerx you can try something like that: var fileInput = document.getElementById('fileInput')
fileInput.value = ''
fileInput.dispatchEvent(new Event('change')) EDIT: BTW it works pretty well see: https://codepen.io/Johann-S/pen/LXOYbR |
Yep. That does the trick. Thank you for your help and sorry for not thinking that through before opening an issue on it! |
No worries thanks you for using my plugin 👍 |
If the input is cleared using something like:
document.getElementById('fileInput').value = '';
The filename stays in place even though the underlying input has been cleared.
The text was updated successfully, but these errors were encountered: