You can use document.createElement() method to create an an empty img element, then add the source.
document.createElement()
function img_add() { var img = document.createElement('img'); img.src = # //link to image document.getElementById('body').appendChild(img); }
I think that's what you were looking for, right?
yes thank you
If you want to load an image into the page, this looks fine. If you do not want to load it into the DOM, then you should be able to do a simple HTTP request to get the image. Can you please describe the issue more, @looph8le ?
i dont know how to add pictures to javascript
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
You can use
document.createElement()
method to create an an empty img element, then add the source.I think that's what you were looking for, right?
yes thank you
If you want to load an image into the page, this looks fine. If you do not want to load it into the DOM, then you should be able to do a simple HTTP request to get the image.
Can you please describe the issue more, @looph8le ?
i dont know how to add pictures to javascript