10 lines
401 B
JavaScript
10 lines
401 B
JavaScript
|
// [x-copy-query="<query selector>"]
|
||
|
// [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
|
||
|
}
|
||
|
})
|