Clipboard
Basic
ClipboardJS is a modern approach to copy text to clipboard. A pretty common use case is to copy content from another element. You can do that by adding a
data-clipboard-target
attribute in your trigger element.
Additionally, you can define a data-clipboard-action
attribute to specify if you want to either copy or cut content. For more references, you can look
ClipboardJS's page.
Textarea
Copy from attribute
You don't even need another element to copy its content from. You can just include a data-clipboard-text
attribute in your trigger element.