如何使用JavaScript清除HTML文件输入? [英] How can I clear an HTML file input with JavaScript?

查看:56
本文介绍了如何使用JavaScript清除HTML文件输入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想清除表单中的文件输入。

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.

注意:我希望避免重新加载页面,重置表单或执行AJAX调用。

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

这可能吗?

推荐答案

如何删除该节点,创建一个新节点同名?

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

这篇关于如何使用JavaScript清除HTML文件输入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆