$("#file").change(function(){ var file = document.getElementById("file"); var fileList = file.files; var img_box="" $(".z_addImg").remove() for(var i=0;i<fileList.length;i++){ console.log(file.files[i]) img_box+='<div class="z_addImg"><img src="'+URL.createObjectURL(file.files[i])+'"></div>' } $(".z_photo").append(img_box) });
//单张图片预览 $("dome").change(function(){ var fileList =document.getElementById("dome").files; $(img).attr("src",URL.createObjectURL(fileList[0])) });
$(".add_p_box").on("change",".file",function(){ var fileList=$(this).prop("files"); $(this).closest("item").find("img").attr("src",URL.createObjectURL(fileList[0])) })