0

Image doesn't appear in js

So I was trying to make a sort of "Image zoomer", just for fun and practiced, it will let you insert the URL of a picture and then scales it to a bigger one so you can see it better, for example for profile pics or something. Anyways, I coded everything needed, but when I put in any URL of an image (I even tried the default Sololearn one), it just doesn't appear. Below there's my code, I hope someone can help me :D https://code.sololearn.com/WmjcLZ01dkVE/?ref=app

27th Jun 2022, 4:10 PM
Diana
2 Answers
+ 4
I found two errors, the declaration and initialization of the img variable must be outside the onclick event, no need to use a window.onload event twice. https://code.sololearn.com/W4JY0xdqW0ar/?ref=app
27th Jun 2022, 5:35 PM
Jhordy Gavinchu
Jhordy Gavinchu - avatar
+ 1
thank youu!!
27th Jun 2022, 8:22 PM
Diana