To set a textContent to the clipboard, you should get the desired element from DOM (eg. document.getElementById(“element-id”)) and access to its content:
then you should set your text to the clipboard :
and when this function is executed, it’s done…!
If you found it useful, you can follow me and also visit my website, because there are more ways to connect with me. I hope this would help you to improve your coding skills. Thank you for your attention.
This article was originally published on The Dev.to on April 8, 2020 and was written by Mohsen Fallahnejad.