Home >Web Front-end >JS Tutorial >Two solutions to clear the selected files in the input file_javascript skills

Two solutions to clear the selected files in the input file_javascript skills

WBOY
WBOYOriginal
2016-05-16 17:19:261446browse

When uploading files, I wanted to clear the file path after selecting the file. I searched and used two methods to solve the problem

Copy the code The code is as follows :



First type:
Copy code The code is as follows:

var obj = document.getElementById('fileupload');
obj.select ();
document.selection.clear();

Second type:
Copy code The code is as follows:

var obj = document.getElementById('fileupload');
obj.outerHTML=obj.outerHTML;
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn