如何重置< input type =" file"> [英] how to reset <input type = "file">

查看:170
本文介绍了如何重置< input type =" file">的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用VS2012和Javascript开发一个metro应用程序

I am developing a metro app with VS2012 and Javascript

我想重置文件输入的内容:

I want to reset the contents of my file input:

<input type="file" id="uploadCaptureInputFile" class="win-content colors" accept="image/*" />

我该怎么做?

推荐答案

@ dhaval-marthak在评论中发布的jQuery解决方案显然有效,但如果你看看实际的jQuery调用,很容易看到jQuery正在做什么,只需设置 value 属性为空字符串。所以在纯JavaScript中它将是:

The jQuery solution that @dhaval-marthak posted in the comments obviously works, but if you look at the actual jQuery call it's pretty easy to see what jQuery is doing, just setting the value attribute to an empty string. So in "pure" JavaScript it would be:

document.getElementById("uploadCaptureInputFile").value = "";

这篇关于如何重置&lt; input type =&quot; file&quot;&gt;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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