Defining where in the DOM CreateImg() creates its image.

I am adding a gif to a p5js sketch using createImg() due to lack of native support for gifs and the p5.gif.js library unable to load external gifs.

How can I define where the img tag should be inserted into the DOM?

For example I'd like it to be inserted inside an existing div with the id of "img-container".

I googled the vanilla javascript way of doing this with appendChild(); however I got a "Uncaught TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'" error.

Tagged:

Answers

Sign In or Register to comment.