I have the following code
document.write("<img src=./", i, ".png width='100px' height='100px'>");
document.write("<img src=./", x, ".png width='100px' height='100px'>");
document.write("<img src=./", y, ".png width='100px' height='100px'>");`
and I want to use the src in getElementById(myImg).InnerHTML.
I tried this
document.getElementById("myImg").innerHTML.src = "./", i, ".png width='100px' height='100px'>";
But It's not working
What is the proper way to write it?
Change the
src, notInnerHTML.src. You can see the answer in this question. and you need to set thewidthheightwith style