jQuery中的Javascript .files [0]属性 [英] Javascript .files[0] attribute in jQuery
本文介绍了jQuery中的Javascript .files [0]属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在jQuery中是否有与此语句等效的内容?
Is there an equivalent to this statement in jQuery?
var value = document.getElementById(id).files[0];
使用附加了.files [0]的标准jQuery选择器似乎无效,并且我找不到与.files等效的jQuery命令.有什么建议?
Using the standard jQuery selectors with .files[0] appended doesn't appear to work, and I can't find an equivalent jQuery command to .files. Any suggestions?
我正在使用它从输入type ='file'表单元素中检索文件.
I'm using this to retrieve the file from an input type='file' form element.
推荐答案
$('#id').get(0).files[0]
get(0)返回DOM元素
get(0) return DOM element
这篇关于jQuery中的Javascript .files [0]属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文