I have a variable in which I populate the image location dynamically.
I need to change the background image with that variable. I am not able to find a way to do that.
var myImg = '/images/example1.jpg';
document.body.style.background = "url(myImg) no-repeat";
This doesn't seem to work.
Is there a syntax issue or should this be done in a different way?