我有以下输入文件标签:
<input type="file" id="handlerxhr1" />
当我在 mozilla 中运行以下 jQuery 代码时:
var input = $('#handlerxhr1')[0];
$('#upload').click(function() {
alert(input.files[0]);
});
我得到响应:[object File](很好)。
但在 IE 中我得到“input.files.0 is undefined”
我做错了什么?
最佳答案
IE 不支持 .files[0] 属性,而 FF 支持。 参见 http://www.w3.org/TR/FileAPI/了解更多详情
关于javascript - IE 输入文件属性未定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5000950/