29 lines
779 B
JavaScript
29 lines
779 B
JavaScript
function copyToClipboard(id) {
|
|
var copyText = document.getElementById(id);
|
|
|
|
/* Select the text field */
|
|
copyText.select();
|
|
copyText.setSelectionRange(0, 99999); /*For mobile devices*/
|
|
|
|
/* Copy the text inside the text field */
|
|
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";
|
|
}
|
|
|
|
function resetClipboard(id) {
|
|
var tooltip = document.getElementById(id);
|
|
tooltip.innerHTML = "Kopieren";
|
|
} |