Скопировать текст: различия между версиями
Материал из ВикиВоины
(не показаны 2 промежуточные версии этого же участника) | |||
Строка 1: | Строка 1: | ||
+ | <button class="button text-copy-button" onclick="copyText()">Скопировать</button> | ||
+ | <script> | ||
function copyText() { | function copyText() { | ||
var textToCopy = document.getElementById("text-copy").innerText; | var textToCopy = document.getElementById("text-copy").innerText; | ||
navigator.clipboard.writeText(textToCopy) | navigator.clipboard.writeText(textToCopy) | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} | } | ||
+ | </script> |
Текущая версия на 15:02, 8 мая 2024
<button class="button text-copy-button" onclick="copyText()">Скопировать</button> <script> function copyText() {
var textToCopy = document.getElementById("text-copy").innerText; navigator.clipboard.writeText(textToCopy)
} </script>