+ 1
Is it possible to store images in variables? [javascript]
3 Answers
+ 3
Image file can be converted to data uri from canvas,
and data uri can be loaded onto img element.
https://code.sololearn.com/W9fK7DZhQ755/?ref=app
https://code.sololearn.com/W8P7d1LUsBay/?ref=app
0
as far as i know you can store an image src in a variable and changing the src whenever event occurs
0
OR You can create an image element using native js like so:
var img = document.createElement("img");
#which create like an img tag
then do img.src = "path to an img"
if that what you want