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
Release: 2016-05-16 17:19:26
Original
1427 people have browsed it

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;
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template