Как мы можем реализовать копирование в буфер обмена функция при нажатии кнопки в NodeJs с использованием экспресс-руля шаблон.
Я пробовал использовать Javascriptно это не работает.
Ниже приведен код, который я пробовал:
myFile.handlebars :
<input type="button" id="linkBtn" class="btn btn-primary" onclick="copyLink()" data-toggle="tooltip" title="Copy to Clipboard" value="copy link" readonly />
<script>
function copyLink() {
let copyText = document.getElementById("linkBtn");
/* Select the text field */
copyText.select();
/* Copy the text inside the text field */
document.execCommand("copy");
/* Alert the copied text */
//alert("Copied the text: " + copyText.value);
}
</script>
Вот ссылка, котораяЯ упомянул: Копировать в буфер обмена с помощью JS