2015-02-24 75 views

回答

1

您可以确定是否其空通过检查文件的长度:

if(document.getElementById("field_1").files.length == 0){ 
    console.log("no files selected"); 
} 
+0

谢谢!这对我有帮助) – nowiko 2015-02-24 14:30:17

+0

没问题,乐于帮忙! – cch 2015-02-24 14:31:02

0

你可以尝试这样的

$('#field_1').change(function() { 
    console.log(this.files[0] instanceof File); 
});