A custom element that implements the Clipboard API to copy text content from elements or input values to the clipboard.
value
attribute:<clipboard-copy value="Copy from value attribute"></clipboard-copy>
from
attribute:<clipboard-copy from="[data-element='span']"></clipboard-copy>
<span data-element="span">Copy text content from span element</span>
<clipboard-copy from="#anchor"></clipboard-copy>
<a id="anchor" href="https://github.com">Copy href from anchor element</a>
<clipboard-copy from="input[type='text']"></clipboard-copy>
<input value="Copy value from input element" type="text">
<clipboard-copy from=".my-textarea"></clipboard-copy>
<textarea class="my-textarea">Copy value from textarea element</textarea>