jQuery 如何删除“输入类型=文件”的值
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16595657/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 17:25:55 来源:igfitidea点击:
How to delete the value of an "input type=file"
提问by KeizerBridge
I want to know how to delete the value of an input type filewith 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.
我希望我是可以理解的。
回答by edonbajrami
You can do:
你可以做:
$(document).ready(function(){
$('input').val("");
});
回答by Joel Eckroth
Try resetting the form back to the initial values:
尝试将表单重置回初始值:
$('#form').each(function(){
this.reset();
});