I would like to retrieve a certain tag element with its attributes from the DOM. For example, from
link text
Here's a solution I've used:
const wrap = document.createElement('div') wrap.appendChild(target.cloneNode(true)) const openingTag = wrap.innerHTML.split('>')[0] + '>'