I have a image tag which is :
<img id="imageUpload" alt="your image" style="display: none;">
I have a base64 code(it is working) of which i have added in string:
var imgName="data:image/png;base64,"+base64codes+"";
console.log(imgName);
How to pass the string value inside the src attribute of image using jquery/javascript?
I tried to pass the imgName
inside attr
using jquery but it is not working.
$('#imageUpload').attr('src',imgName);
my console for imgName is :
Your code looks correct. Maybe you just have to remove the style 'display: none'
$('#imageUpload').attr('style', '');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.