Copy using clipboard.
function copyTextToClipboard(selector) {
const text = document.querySelector(selector).innerText;
window.navigator.clipboard.writeText(text).then(() => {
console.log("done")
}, (err) => {
console.log("Got error", err)
})
}
Usage:
copyTextToClipboard(".content")