Copy Text Selection To Clipboard - jQuery Copy.js
File Size: | 7.77 KB |
---|---|
Views Total: | 2803 |
Last Update: | |
Publish Date: | |
Official Website: | Go to website |
License: | MIT |
Copy.js is an extremely lightweight jQuery copy to clipboard plugin that allows copying any text you specify to the clipboard using document.execCommand('copy') API.
How it works:
- Create a temporary textarea in the document.
- Insert the selected text into the textarea.
- Copy the textarea element to the clipboard.
- Remove the textarea.
More copy to clip plugins:
- Copy Text To Clipboard Plugin - pcsCpClipboard.js
- jQuery Plugin To Copy Any Text Into Your Clipboard - Copy to Clipboard
- Simplest Copy To Clipboard Library (Pure JavaScript)
- Lightweight Copy To Clipboard Library – nanoclipboard (Pure JavaScript)
- Copy Text To Clipboard with Single Click – Clipboard Button (Pure JavaScript)
How to use it:
1. Place both jQuery library and the jQuery Copy.js plugin at the end of the html document so the page loads fast.
<script src="jquery.min.js"></script> <script src="jquery.copy.js"></script>
2. Copy the text within a specific container to the clipboard.
$.copy($("h3").text()); $.copy($("p")); ...
Change log:
2017-07-05
- check nonexist jqury object
This awesome jQuery plugin is developed by by-syk. For more Advanced Usages, please check the demo page or visit the official website.