// [x-copy-query=""] // [x-inner-text] - will use innerText document.querySelectorAll("[x-copy-query]") .forEach(e => { if (e.hasAttribute("x-inner-text")) { e.innerText = document.querySelector(e.getAttribute("x-copy-query")).innerHTML } else { e.innerHTML = document.querySelector(e.getAttribute("x-copy-query")).innerHTML } })