18 lines
459 B
JavaScript
18 lines
459 B
JavaScript
const button = document.getElementById("copy");
|
|
button.classList.remove("hidden");
|
|
button.onclick = () => {
|
|
if (!navigator.clipboard) {
|
|
button.innerText = "nicht unterstützt";
|
|
return;
|
|
}
|
|
const content = document.getElementsByClassName("copy-content")[0];
|
|
navigator.clipboard.writeText(content.textContent).then(
|
|
(_) => {
|
|
button.innerText = "kopiert!";
|
|
},
|
|
(_) => {
|
|
button.innerText = "nicht unterstützt";
|
|
}
|
|
);
|
|
};
|