- Notifications
You must be signed in to change notification settings - Fork257
Copy element text content or input values to the clipboard.
License
NotificationsYou must be signed in to change notification settings
github/clipboard-copy-element
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Copy element text content or input values to the clipboard.
$ npm install --save @github/clipboard-copy-elementImport as ES modules:
import'@github/clipboard-copy-element'
With a script tag:
<scripttype="module"src="./node_modules/@github/clipboard-copy-element/dist/index.js">
<clipboard-copyfor="blob-path"class="btn btn-sm BtnGroup-item"> Copy path</clipboard-copy><divid="blob-path">src/index.js</div>
<clipboard-copyvalue="src/index.js">Copy</clipboard-copy>
<clipboard-copyfor="blob-path">Copy</clipboard-copy><divid="blob-path">src/index.js</div>
<clipboard-copyfor="blob-path">Copy</clipboard-copy><inputid="blob-path"value="src/index.js">
<clipboard-copyfor="blob-path">Copy full URL</clipboard-copy><aid="blob-path"href="/path/to#my-blob">Link text will not be copied</a>
After copying to the clipboard, aclipboard-copy event is dispatched fromthe<clipboard-copy> element:
document.addEventListener('clipboard-copy',function(event){constbutton=event.targetbutton.classList.add('highlight')})
Browsers without nativecustom element support require apolyfill.
- Chrome
- Firefox
- Safari
- Microsoft Edge
npm installnpm testDistributed under the MIT license. See LICENSE for details.
About
Copy element text content or input values to the clipboard.
Topics
Resources
License
Code of conduct
Contributing
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.