$( ‘#pic‘ ).change(function () {
var file = $(this)[0].files[0];
var reader = new FileReader();
reader.readAsDataURL(file);
reader.onload=function () {
$(‘#mypic‘)[0].src = this.result;
}
})
//一个简单的js图片预览功能,需要有个id 。 2018年10月29日。晚。
原文:https://www.cnblogs.com/woshitgy/p/9874047.html