Copie o texto para o JavaScript
//As simple as this
navigator.clipboard.writeText("Hello World");
Silly Sable
//As simple as this
navigator.clipboard.writeText("Hello World");
function copyToClipboard(text) {
const elem = document.createElement('textarea');
elem.value = text;
document.body.appendChild(elem);
elem.select();
document.execCommand('copy');
document.body.removeChild(elem);
}
navigator.clipboard.writeText("Copied to clipboard");
Also works on safari!
function copyToClipboard() {
var copyText = document.getElementById("share-link");
copyText.select();
copyText.setSelectionRange(0, 99999);
document.execCommand("copy");
}
navigator.clipboard.writeText("Hello, World!");
function textToClipboard (text) {
var dummy = document.createElement("textarea");
document.body.appendChild(dummy);
dummy.value = text;
dummy.select();
document.execCommand("copy");
document.body.removeChild(dummy);
}