从多个“输入:文件”中移除FileList项目 [英] Remove a FileList item from a multiple "input:file"
本文介绍了从多个“输入:文件”中移除FileList项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这个DOM:
var id = 0;
$('input:file#upload')[0].files[ id ]
这是第0个索引中的第一个文件。文件属性列出并且一切正常,但是......
That get's the first file on the 0th index. File properties are listed and all works, but...
我们如何从DOM的 [object FileList]中删除项目
使用JavaScript?
How do we remove items from the DOM's [object FileList]
with JavaScript?
推荐答案
我担心你无法从<$ c删除对象$ c> FileList对象直接。只要将 $('input:file#upload')[0] .files
分配给 Array
,然后移除项目从该数组中使用 splice
或您选择的方法,然后使用 Array
。
I' am afraid that you cannot delete objects from FileList object
directly. Just assign $('input:file#upload')[0].files
to an Array
and then remove items from that array using splice
or method of your choice and then use that Array
.
这篇关于从多个“输入:文件”中移除FileList项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文