I have written some basic code to generate and remove an image using functions. Specifically, I need help with removing the image created by the function Generate()
when a button linked to the function Reset1()
is clicked. Here's the code snippet for reference:
function Generate() {
var image = document.createElement('img');
var div = document.getElementById('flex-box-gen');
image.src = "https://thecatapi.com/api/images/get?format=src&type=gif&size=small";
div.appendChild(image);
}
function Reset1() {
document.getElementById('Generate').remove();
}