如何删除“input type = file”的值[重复]

时间:2022-11-20 00:03:41

This question already has an answer here:

这个问题在这里已有答案:

I want to know how to delete the value of an input type file with Jquery.

我想知道如何使用Jquery删除输入类型文件的值。

More precisely what I call the value is when you upload a file from this input, but you haven't send the form.

更确切地说,当您从此输入上传文件时,我称之为值,但您尚未发送表单。

I hope i'm understandable.

我希望我能理解。

2 个解决方案

#1


45  

You can do:

你可以做:

$(document).ready(function(){

   $('input').val("");

});

#2


-7  

Try resetting the form back to the initial values:

尝试将表单重置为初始值:

$('#form').each(function(){
    this.reset();
});

#1


45  

You can do:

你可以做:

$(document).ready(function(){

   $('input').val("");

});

#2


-7  

Try resetting the form back to the initial values:

尝试将表单重置为初始值:

$('#form').each(function(){
    this.reset();
});