我得到 'this.0.files.0' is null or not an object error on IE8 and IE9 and Chrome and Mozila don't throw any errors 。
$(function()) {
var fileType = ['txt' , 'csv' ];
$('.input_file').find('input [type = "file" ]').live('change', function (e)) {
$this = $(this)
var ext = $this.val() === " " ? " " : this.value.match(/\.(.+)$/)[1];
if($this.val()) {
$this.parent().find('label').text.($this[0].files[0].name)
}
}
}
我不确定为什么上面的代码会引发 javascript 错误 'this.0.files.0' is null or not an object