Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/schmod/jclipboard
A jQuery plugin that allows rich text to be copied to the clipboard. (Uses Flash)
https://github.com/schmod/jclipboard
Last synced: about 2 months ago
JSON representation
A jQuery plugin that allows rich text to be copied to the clipboard. (Uses Flash)
- Host: GitHub
- URL: https://github.com/schmod/jclipboard
- Owner: schmod
- Created: 2012-02-21T23:13:40.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2012-10-11T20:16:47.000Z (about 12 years ago)
- Last Synced: 2024-04-29T21:23:42.173Z (8 months ago)
- Language: JavaScript
- Homepage:
- Size: 102 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
jClipboard
==========
Copy text to your clipboard with jQuery
---------------------------------------jClipboard is a small jQuery plugin that allows you to copy rich text to the system clipboard. jClipboard is loosely based around [jClip](http://www.steamdev.com/zclip/) and [Zero Clipboard](http://www.steamdev.com/zclip/), but weighs much less, thanks to the delegation of much of the heavy lifting to jQuery. Unlike other solutions that work with rich text, jClipboard also provides the system clipboard with a text-only rendition of your content for applications that cannot accept HTML.
Requires Flash 10. Sorry.
###Installation
[Download jClipboard](https://github.com/schmod/jClipboard/tarball/master), extract somewhere into your site, and include jQuery and jClipboard in your page
###Usage
Activate jClipboard on the element that you'd like to use as your copy button.
````javascript
$('a.copy').jclip({
path:'js/jClip10.swf',
copy:function(){
return $('textarea#myText').val();
}
)};
````We accept some other parameters too. Here's a full list:
* `path`: Path to the jClipboard .SWF file. Defaults to `js/jClip10.swf`
* `copy`: Tells jClip what text or elements to copy. Accepts strings, jQuery objects, DOM Elements, and functions.
* `success`: Callback function executed after text has been copied. Accepts one parameter containing the text that was copied.
* `setHandCursor`: Set to `false` if you do not wish to use a pointer cursor over your copy button. Defaults to `true`.