input上传图片后预览

<input type="file" id="expertPhoto"/>
<img src="" class="img"/>
$('#expertPhoto').change(function(){
    $('.img').attr('src',URL.createObjectURL($(this)[0].files[0]))
})

 

posted on 2019-08-28 17:41  碎片时间  阅读(111)  评论(0编辑  收藏  举报

导航