How to show image on browser by using javascript. Plz tell me code. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to show image on browser by using javascript. Plz tell me code.

30th May 2018, 3:16 AM
BALOOCH ANZARAHMEDKHAN ZAKIRAHMEDKHAN
BALOOCH ANZARAHMEDKHAN ZAKIRAHMEDKHAN - avatar
2 Answers
+ 2
var img = document.createElement("img"); img.src = "..."; img.alt = "?"; document.body.appendChild(img);
30th May 2018, 4:39 AM
Jonas Schröter
Jonas Schröter - avatar
+ 1
You can easily add an image using HTML: <img src="example.com"></img> If you really want to use js, consider Jonas Schröter 's example
30th May 2018, 6:01 AM
ReimarPB
ReimarPB - avatar