First of all, very new to javascript and coding in general here so apologies for that. I am appending a new image from a URL submitted from a form. I need to dynamically add a div to the image when it is loaded into the DOM so I can ultimately add some text to the top and the bottom of the image. This is for a meme generator style app. Not sure if the remove logic at the end is pertinent but I will include it just in case. Thanks in advance!
form.addEventListener('submit', function(e) {
e.preventDefault();
let newMeme = new Image(470, 300);
newMeme.src = imageURL.value;
newMeme.setAttribute('class', 'memeStyle');
memeDiv.appendChild(newMeme);
imageURL.value = '';
newMeme.addEventListener('click', function(e) {
newMeme.remove(e.target);
console.log(e.target);
});
});