This article was originally posted on my blog. Head over to inspiredwebdev.com for more articles and tutorials. Check out my JavaScript course on ...
For further actions, you may consider blocking this person and/or reporting abuse
Might be worthwhile discussing
navigator.clipboard
tooYou need to add it to the DOM so that you can then select its content. As I said, if the element you want to copy to clipboard is an input field you don't need to do that.
I built a reusable React component using the same method. You can check it out at npmjs.com/package/react-copy-content
This is cool Is it how various web clippers work? Like Evernote and Notion?