document.addEventListener( "DOMContentLoaded" , () => { document.querySelectorAll("[content='myTarget']").forEach((span, i) => { +span.textContent && (span = span.closest(".delete")) && span.remove() } ) });