An Interest In:
Web News this Week
- April 1, 2024
- March 31, 2024
- March 30, 2024
- March 29, 2024
- March 28, 2024
- March 27, 2024
- March 26, 2024
July 15, 2021 03:05 am GMT
Original Link: https://dev.to/hills2003/how-to-implement-copy-and-paste-in-a-web-application-37aj
How to implement copy and paste in a web application
Ever wondered how to implement copy and paste functionality in any of your web applications?
yes , I have
It is pretty much easier than it sounds , we only have to access the navigator.clipboard object to perform this.
1 copy
navigator.clipboard.writeText(e.target.value);
And that's all you need to copy whatsoever to the browsers clipboard
2 paste
This is almost same as the previous
navigator.clipboard.readText().then((text)=>console.log(text))
and there you have it , what you copied in your browsers console.
Easy peazy!!!
Original Link: https://dev.to/hills2003/how-to-implement-copy-and-paste-in-a-web-application-37aj
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To