上传图片后直接显示的方法
html:
<button class="btn btn-info" id="uploadImage">上传图片</button> <input type="file" name="img" style="display:none">
<div class="imageShow">
</div>
js:
// 先加载jq
<script>
$(document).ready(function () {
$('#uploadImage').click(function(){
$('[name="img"]').trigger('click');
})
$('input[name="img"]').change(function(){
$('.imageShow').html('<img class="addImagees" src="'+ window.URL.createObjectURL( $('[name="img"]')[0].files[0])+'" width="100%" /> ');
})
});
</script>