I'm making a plugin with tempermonkey where I want to delete the div where the button is inside, but the div element doesn't have an id, only a class thats used for different elements. I only want to delete the one where the button is pressed. Thank you.
// 1. Create the buttons
var x;
var y = document.getElementsByClassName("tasksAndMaterials__label");
for (x = 0; x < y.length; x++) {
var br = document.createElement("br");
document.getElementsByClassName("tasksAndMaterials__label")[x].appendChild(br);
var btn = document.createElement("BUTTON");
btn.innerHTML = "Done";
document.getElementsByClassName("tasksAndMaterials__label")[x].appendChild(btn);
}