+ 1

Is it possible to store images in variables? [javascript]

9th Mar 2020, 6:54 PM
Sort Me Out
Sort Me Out - avatar
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
9th Mar 2020, 10:27 PM
CalviŐ˛
CalviŐ˛ - avatar
0
as far as i know you can store an image src in a variable and changing the src whenever event occurs
9th Mar 2020, 7:12 PM
yossef Dawoad
yossef Dawoad - avatar
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
9th Mar 2020, 7:13 PM
yossef Dawoad
yossef Dawoad - avatar