This is an exercise from a test.
I need to get the remove button working. I don't understand why the line
document.getElementsByClassName("remove")[0].click();
is there either
Here is the code
function setup() {
// Write your code here.
}
// Example case.
document.body.innerHTML = `
<div class="image">
<img src="someimage.jpg" alt="First">
<button class="remove">X</button>
</div>
<div class="image">
<img src="someimage.jpg" alt="Second">
<button class="remove">X</button>
</div>`;
setup();
document.getElementsByClassName("remove")[0].click();
console.log(document.body.innerHTML);
Edit: The expected output is that the remove button would remove the parent div (class="image")