Скопировать текст
Материал из ВикиВоины
Версия от 14:59, 8 мая 2024; Laurent Nautilus (обсуждение | вклад)
<button class="button text-copy-button" onclick="copyText()">Скопировать текст</button> <script> function copyText() {
var textToCopy = document.getElementById("text-copy").innerText; navigator.clipboard.writeText(textToCopy) .then(() => { alert("Текст скопирован!"); }) .catch(err => { console.error('Ошибка копирования: ', err); });
} </script>