+ 16

Copy and paste in JS ...

Does anyone know how to copy the text content of an element via JS , i know using the execCommand ("Copy") you can copy selected input elements and copy it to clipboard but can it be done on any other elements than an input?

6th Feb 2018, 1:11 AM
Cyberspace Cyborg
Cyberspace Cyborg - avatar
2 Réponses
+ 16
click elements check the JS code for implementation as you might notice, the program first selects the text, and then copy so it does not matter if the element is an input, div, span or whatever https://code.sololearn.com/WyFNkf7jnqnZ/?ref=app
6th Feb 2018, 6:47 AM
Burey
Burey - avatar
+ 1
idk
19th Mar 2019, 8:11 PM
billy