// Add delete buttons below div.markdown elements const markdownDivs = document.querySelectorAll('.group'); markdownDivs.forEach((div, index) => { const deleteButton = document.createElement('button'); deleteButton.textContent = 'Delete'; deleteButton.classList.add('delete-button'); deleteButton.addEventListener('click', () => { // Remove the corresponding div when the delete button is clicked div.remove(); }); // Append the delete button to the div div.appendChild(deleteButton); });