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.(@ dhaval-marthak在评论中发布的jQuery解决方案显然有效,但是如果您查看实际的jQuery调用,则很容易看到jQuery在做什么,只需将value
属性设置为一个空字符串即可。)
So in "pure" JavaScript it would be:(因此,在“纯” JavaScript中,它将是:)
document.getElementById("uploadCaptureInputFile").value = "";
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…