3
I have an input field that should receive an image, when receiving it I should add it as background-image
from a div. I used Filereader to get the Base64 from the image. It works fine, but CSS cannot load the image. Since they are user inputs I can’t get a URL.
I’ve tried using:
document.getElementById('div').style.backgoundImage = "url('${imageData}')";
.div{
position: absolute;
background-image: url('${imageData}');
}
Why put it in the CSS if Javascript has already changed the background? In addition to what CSS is interpreted when opening the page, after that you cannot change its source code.
– Sam
Javascript did not change the background, those were examples of failed attempts.
– Valeria Machado