cópia js para a área de transferência
navigator.clipboard.writeText("Copied to clipboard");
Code Cat
navigator.clipboard.writeText("Copied to clipboard");
function copy() {
var copyText = document.querySelector("#input");
copyText.select();
document.execCommand("copy");
}
document.querySelector("#copy").addEventListener("click", copy);
navigator.clipboard.writeText('the text')
navigator.clipboard
.writeText("Text")
.then(() => console.log("Copied to clipboard"))
.catch((err) => console.log(err))
navigator.clipboard.writeText("Hello, World!");
// Copies the image as a blob to the clipboard (PNG only)
navigator.clipboard.write([
new ClipboardItem({
[blob.type]: blob,
}),
])