im trying to make an src for an img
element that i have in my HTML file, but for some reason, when I try to insert a source into an image,
the workspace does not recognize the img
object as an image object, and therefore does not allow src to be inserted there.
It is important to emphasize that this problem only exists in the work environment I work with (WebStorm). When I tried to put the code into an online work environment, it worked great.
My attempt to put src in WebStorm despite the problem like this:
HTML:
<img id="img" src="https://source.unsplash.com/random">
JS:
let img = document.getElementById("img");
img.src = "https:\/\/images.dog.ceo\/breeds\/terrier-toy\/n02087046_3843.jpg";
But it just made the work environment react with this error:
Cannot set properties of null (setting 'src')