I want to use a JavaScript variable which is equal to the url of an image in a html img tag. I need the following tag to be able to display the image that is tied to the variable.
document.getElementById("id-of-img-tag").src = imgVar;
document.getElementById("id-of-img-tag").innerHTML = imgVar;
<img id="id-of-img-tag" src=" " alt="img">
Both of the lines of JS result with the alternative being displayed for the img tag "img".