How can I clear an HTML file input with JavaScript?

I want to clear the file input in my form.

I know about setting the sources to the same method… But that method wont erase the selected file path.

Note: I would like to avoid having to reload the page, reset the form or perform an AJAX call.

Is this possible?

Answer

How about removing that node, creating a new one with the same name?

Leave a Reply

Your email address will not be published. Required fields are marked *