<script type="text/javascript">
$('.image').change(function(event) {
var _this = this;
if(_this.files.length<=0){
// console.log('未選擇文件');
}else{
// console.log(file.files);
$(_this.files).each(function(index, el) {
var fileRader = new FileReader();
fileRader.onload = function(){
// console.log(this.result);
$(_this).next('a').find('img').attr('src',this.result)
}
fileRader.readAsDataURL(el);
});
}
});javascript
</script>java