loading...

re: Copy text to the clipboard with JavaScript in 10 lines of code VIEW POST

TOP OF THREAD FULL DISCUSSION
re: Do we need to add the textarea to the document though? Couldn't we just skip the styling and keep it as a JavaScript constant?
 

You need to add it to the DOM so that you can then select its content. As I said, if the element you want to copy to clipboard is an input field you don't need to do that.

 
code of conduct - report abuse