Looking for help with styling an element created using document.createElement("img")?
let fireball; //global variable
fireball = document.createElement("img") //variable on local
fireballArray.push(someFunction(fireball, {
src: "img.png", width: "38" }))
fireball.style.display = "none" //global variable
I want to style the element created by
fireball = document.createElement("img")
, but it's not hiding as expected.
Any suggestions or solutions would be greatly appreciated. Thank you in advance!
Note: The variable
fireball = document.createElement("img")
must remain within local scope while styling should be applied from another scope (as shown in the code).