Open laurentkempe opened 2 years ago
From @meziantou
function copyCodeBlock(elt, id) { navigator.clipboard.writeText(document.getElementById(id).textContent) .then(() => { elt.disabled = true; var body = elt.innerHTML; elt.innerHTML = "copied"; setTimeout(() => { elt.innerHTML = body; elt.disabled = false; }, 1000) }); }
From @meziantou