const copyText = () => {
const text = "Hello, Clipboard API!"
navigator.clipboard
.writeText(text)
.then(() => {
console.log("Text copied to clipboard")
})
.catch((error) => {
console.error("Failed to copy text: ", error)
})
}
Sort: Trending