adding image tag javascript code example
Example 1: img html
<img src="smiley.gif" alt="Smiley face" height="42" width="42">
Example 2: javascrpit add image element
function add_img() {
var img = document.createElement('img');
img.src = 'https://media.geeksforgeeks.org/wp-content/uploads/20190529122828/bs21.png';
document.getElementById('body').appendChild(img);
}
Example 3: how to add image in html
<img src="img_girl.jpg" alt="Image Load Error" width="500" height="600">