copy to clipboard
This commit is contained in:
20
copy-to-clipboard.js
Normal file
20
copy-to-clipboard.js
Normal file
@@ -0,0 +1,20 @@
|
||||
function copyToClipboard() {
|
||||
var copyText = document.getElementById("copy-to-clipboard");
|
||||
|
||||
/* Select the text field */
|
||||
copyText.select();
|
||||
copyText.setSelectionRange(0, 99999); /*For mobile devices*/
|
||||
|
||||
/* Copy the text inside the text field */
|
||||
document.execCommand("copy");
|
||||
}
|
||||
|
||||
function copiedToClipboard() {
|
||||
var tooltip = document.getElementById("copy-to-clipboard-tooltip");
|
||||
tooltip.innerHTML = "Kopiert";
|
||||
}
|
||||
|
||||
function resetClipboard() {
|
||||
var tooltip = document.getElementById("copy-to-clipboard-tooltip");
|
||||
tooltip.innerHTML = "Kopieren";
|
||||
}
|
||||
Reference in New Issue
Block a user