17 lines
424 B
JavaScript
17 lines
424 B
JavaScript
const button = document.getElementById("copy");
|
|
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";
|
|
}
|
|
);
|
|
};
|