<!DOCTYPE html>
<html>
<head>
<title></title>
<style type="text/css">
#c{
width: 300px;
height: 300px;
}
#b{
display: none
}
</style>
</head>
<body>
<label for="b" id="a">
<img src="D://a.jpg" id="c">
</label>
<input type="file" name="" id="b">
<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-3.5.1.min.js"></script>
<script type="text/javascript">
$("#b").change(function(){
var file_obj = $(this)[0].files[0]
var reader = new FileReader()
reader.readAsDataURL(file_obj)
reader.onload=function(){
$("#c").attr("src",reader.result)
console.log(reader.result)
console.log("结束")
}


})
</script>
</body>
</html>

 

-----------------------------------------------------------------------------------------------------------------------------------------