How can I add functions to the Copy and Cut buttons? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How can I add functions to the Copy and Cut buttons?

https://code.sololearn.com/WZZXO21ZNlbp/?ref=app

14th Jul 2018, 1:19 PM
B.D
B.D - avatar
8 Answers
+ 5
Remember the w3 example works only on input elements
14th Jul 2018, 3:02 PM
Toni Isotalo
Toni Isotalo - avatar
15th Jul 2018, 4:49 AM
CalviÕ²
CalviÕ² - avatar
14th Jul 2018, 1:20 PM
Paul Grasser
Paul Grasser - avatar
+ 3
... and not on all browsers šŸ˜‰
14th Jul 2018, 3:08 PM
KrOW
KrOW - avatar
+ 2
Yeah, ran into this exact issue when I was putting together something to help a client copy/paste blockchain/cryptocurrency addresses. I thought this was a somewhat reasonable explanation geared toward non-technical folks: "[...] interactive sites that use Web code (in particular, one calledĀ JavaScript) to look and act like programs installed directly on your computer, and a standard security precaution in browsers that blocks Web code from any access to the system clipboard. Why lock them out? Your computer can't tell the difference between a JavaScript-driven action that you took, such as clicking a button in a Web app, and one that a website executed on its own and without your consent. And it's a lot easier to find yourself on a malicious website than to install malicious software on your Mac or PC." (citation: https://www.usatoday.com/story/tech/columnist/2014/04/13/copy-and-paste-in-google-docs/7568661/ )
14th Jul 2018, 9:51 PM
Janningā­
Janningā­ - avatar
+ 1
Its not so easy because different "standards" and different behaviours https://dzone.com/articles/cross-browser-javascript-copy-and-paste
14th Jul 2018, 1:46 PM
KrOW
KrOW - avatar
0
yes
14th Jul 2018, 1:21 PM
B.D
B.D - avatar
0
And cut?
14th Jul 2018, 1:27 PM
B.D
B.D - avatar