copy auch für divs

This commit is contained in:
electronicfreak
2023-10-29 22:14:25 +01:00
parent 6f4c30fc7a
commit 588347e71d
3 changed files with 11 additions and 3 deletions

View File

@@ -9,6 +9,15 @@ function copyToClipboard(id) {
document.execCommand("copy");
}
function copyDivToClipboard(id) {
let range = document.createRange();
range.selectNode(document.getElementById(id));
window.getSelection().removeAllRanges();
window.getSelection().addRange(range);
document.execCommand("copy");
window.getSelection().removeAllRanges();
}
function copiedToClipboard(id) {
var tooltip = document.getElementById(id);
tooltip.innerHTML = "Kopiert";