I have this function for copying the browser's url to the clipboard:
const preCopy = "Copy Link"
const postCopy = "Copied Link"
function copyURI(evt) {
evt.preventDefault()
navigator.clipboard.writeText(evt.target.getAttribute("href")).then(
() => {
evt.target = postCopy
setTimeout(() => {
evt.target = preCopy
}, 30000)
},
() => {}
)
}
And I would like to implement this here when clicking on this text link:
<text>
"Copy Link"
</text>
Would that be possible or do I need a button instead? How could I achieve this? Thanks
question from:
https://stackoverflow.com/questions/65908654/copy-text-link-to-clipboard 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…