www/assets/js/copy.js

19 lines
512 B
JavaScript
Raw Normal View History

2023-11-22 19:01:38 +03:00
async function copy2Clipboard(id) {
var copyText = document.getElementById(id);
// copyText.select();
// copyText.setSelectionRange(0, 99999); // For mobile devices
navigator.clipboard.writeText(copyText.innerHTML);
var tooltip = document.getElementById(id+'-tip');
tooltip.innerHTML = "Kopyalandı! ";
tooltip.style.display = 'inherit';
tooltip.style.color = 'green';
tooltip.style.fontSize = "smaller";
await new Promise(r => setTimeout(r, 2000));
tooltip.style.display= 'none';
}