Copy text not working | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Copy text not working

https://code.sololearn.com/W3su0XYR7jjd/?ref=app Just check the JavaScript copy text is not working and shows error for me.

13th Aug 2021, 4:43 AM
GOLLAKOTI VENKATA SAI SIVA MANI CHANDU
GOLLAKOTI VENKATA SAI SIVA MANI CHANDU - avatar
3 Answers
+ 2
Can you please just edit it and re-upload the code?
13th Aug 2021, 5:54 AM
GOLLAKOTI VENKATA SAI SIVA MANI CHANDU
GOLLAKOTI VENKATA SAI SIVA MANI CHANDU - avatar
+ 1
You need to use <x> as content or value of an HTML element (usually a text input). You should get a reference to the element e.g. let's name it <element>, and then you go <element>.select(); <element>.setSelectionRange(0, 99999); And finally ...  document.execCommand("copy");
13th Aug 2021, 5:51 AM
Ipang
+ 1
Sorry, looks like I have to run again ... Someone will point you out soon 👍
13th Aug 2021, 5:56 AM
Ipang